Expand description
The real ToolService for the shared world: bridges an agent’s tool calls
to the built-in and MCP executors, applying the same policy / approval /
interaction flow the imperative worker used - but with interactions routed
through the in-memory leviath_runtime::interaction_hub instead of file
polling.
The pipeline already applies context_* tools inline (they need ECS-window
access), so those never reach here. Every other call is resolved against the
agent’s policy layers and executed; ask_user_* / present_for_review are
handled by dispatch_dynamic_interaction. File-tracking result rewriting is
deliberately not done here: this executor is ECS-free (no context window),
so the shared world’s collect_tools applies the agent’s file_tracking
config to these results downstream - where the window is available - via the
same path top-level agents use. Every daemon agent, sub-agent included, gets
file-tracking whenever its blueprint declares it.
Structs§
- Agent
Tool State - Everything one agent needs to execute a tool call: the executors, its policy
layers, and its interaction backend. All fields are cheap
Arcs so a clone is moved into eachexec_forclosure. The stage-scoped fields (stage_perms/stage_name) are shared handles the host updates as the agent changes stage. - CliTool
Service - The shared-world tool service: maps entities to their
AgentToolStateand builds a per-call executor closure. - Dynamic
Tool Ctx - Re-resolution inputs for a
dynamic_toolsagent - held soCliToolServicecan re-scan itstools/directories and re-filter its stage tool defs mid-run. - Write
Budget - Everything one agent needs to execute a tool call: the executors, its policy
layers, and its interaction backend. All fields are cheap
Arcs so a clone is moved into eachexec_forclosure. The stage-scoped fields One run’s write ceilings and what it has spent of them (issue #252).
Functions§
- dispatch_
tools - Resolve policy, handle approvals / dynamic interactions, and execute a batch
of tool calls, returning
(tool_call_id, result)pairs in call order.