feat(tool): add tool runtime core #275

Closed
opened 2026-02-22 23:40:48 +00:00 by freemo · 1 comment
Owner

Metadata

  • Commit: feat(tool): add tool runtime core
  • Branch: feature/m1-tool-runtime-core

Subtasks

  • Add ToolSpec, ToolResult, and ToolError models with namespaced tool names, JSON Schema inputs/outputs, and capability metadata (read_only, writes, checkpointable).
  • Implement ToolRunner with lifecycle hooks (discover/activate/execute/deactivate), strict JSON-serializable IO, and error normalization.
  • Add in-memory ToolRegistry for built-ins with list/show lookup by namespaced name and type (tool/validation).
  • Add docs/reference/tool_runtime.md describing tool lifecycle, capability flags, and error/result semantics.
  • Tests (Behave): Add scenarios for tool registration, missing tool errors, capability flag validation, and lifecycle hook ordering.
  • Tests (Robot): Add Robot test that registers a mock tool and executes it via ToolRunner.
  • Tests (ASV): Add benchmarks/tool_runtime_bench.py for tool execution overhead baseline.
  • Run nox (all default sessions, including benchmark), fix any errors if needed ensuring nox passes.
  • Verify coverage >=97% via nox -s coverage_report. If coverage is <97% then review the current unit test coverage report at build/coverage.xml and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun nox -s coverage_report to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.

Section: ### Section 5: Actors, Skills & Tool Execution [WORKSTREAM C - Aditya Lead]
Status: Completed

## Metadata - **Commit**: `feat(tool): add tool runtime core` - **Branch**: `feature/m1-tool-runtime-core` ## Subtasks - [x] Add `ToolSpec`, `ToolResult`, and `ToolError` models with namespaced tool names, JSON Schema inputs/outputs, and capability metadata (`read_only`, `writes`, `checkpointable`). - [x] Implement `ToolRunner` with lifecycle hooks (`discover/activate/execute/deactivate`), strict JSON-serializable IO, and error normalization. - [x] Add in-memory `ToolRegistry` for built-ins with list/show lookup by namespaced name and type (tool/validation). - [x] Add `docs/reference/tool_runtime.md` describing tool lifecycle, capability flags, and error/result semantics. - [x] Tests (Behave): Add scenarios for tool registration, missing tool errors, capability flag validation, and lifecycle hook ordering. - [x] Tests (Robot): Add Robot test that registers a mock tool and executes it via ToolRunner. - [x] Tests (ASV): Add `benchmarks/tool_runtime_bench.py` for tool execution overhead baseline. - [x] Run `nox` (all default sessions, including benchmark), fix any errors if needed ensuring nox passes. - [x] Verify coverage >=97% via `nox -s coverage_report`. If coverage is <97% then review the current unit test coverage report at `build/coverage.xml` and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun `nox -s coverage_report` to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%. **Section**: ### Section 5: Actors, Skills & Tool Execution [WORKSTREAM C - Aditya Lead] **Status**: Completed
freemo added this to the v3.1.0 milestone 2026-02-22 23:40:48 +00:00
freemo self-assigned this 2026-02-22 23:40:48 +00:00
Author
Owner

Implementation Notes — C0.runtime: Tool Runtime Core

2026-02-14: Stage C0.runtime Complete - Tool Runtime Core

  • Created runtime.py (ToolSpec, ToolResult, ToolError), registry.py (thread-safe ToolRegistry with RLock), runner.py (ToolRunner with 4-stage lifecycle: discover/activate/execute/deactivate).
  • New tool modules have 100% coverage.

(Migrated from docs/implementation-notes.md)

## Implementation Notes — C0.runtime: Tool Runtime Core **2026-02-14**: Stage C0.runtime Complete - Tool Runtime Core - Created `runtime.py` (ToolSpec, ToolResult, ToolError), `registry.py` (thread-safe ToolRegistry with RLock), `runner.py` (ToolRunner with 4-stage lifecycle: discover/activate/execute/deactivate). - New tool modules have 100% coverage. *(Migrated from `docs/implementation-notes.md`)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#354 Epic: Actor & Skill Schema + CLI (C0)
cleveragents/cleveragents-core
Depends on
#63 feat(tool): add tool runtime core
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#275
No description provided.