Tool execution dispatch. Classifies, executes, and returns results for tool calls from the LLM. Handles plain tools, skill activation, and subagent spawning.
execute_one/2 runs a single tool call and returns {result, side_effects}
where side effects are tagged tuples applied by ToolRunner after collection.
This design supports parallel execution — children can't share or modify
Server state, so state changes are deferred as data.
Skill activation runs the skill as a forked sub-conversation in the
parent agent's process via SkillKit.Agent.SkillActivation. The parent
receives the sub-loop's final text as the activate_skill tool's
result. No child agent supervision tree is spawned.
Subagent delegation returns immediately (the subagent runs independently).
Tools that need external input return {:suspended, execution, side_effects}
to suspend rather than blocking.
Summary
Functions
Builds the context map passed to Tool.execute/1 for a given tool
call name.
Executes a single tool call. Returns {result, side_effects} or
{:suspended, execution, side_effects}.
Types
Functions
Builds the context map passed to Tool.execute/1 for a given tool
call name.
The context contains:
:agent— the full agent struct (scope, name, etc.).:agent_name— the root agent's name. For an activate_skill child this is the parent's name, not the ephemeral child name — so state that outlives the child (e.g. a webhook registration) is bound to the right agent.:scope— shortcut toagent.scope.- Tool-specific metadata merged in (e.g.,
:cwd,:envfor Shell;:supervisor,:verifiersfor Webhook).
@spec execute_one(SkillKit.Agent.Server.t(), SkillKit.Types.ToolCall.t()) :: {SkillKit.Types.ToolResult.t(), [side_effect()]} | {:suspended, SkillKit.ToolExecution.t(), [side_effect()]}
Executes a single tool call. Returns {result, side_effects} or
{:suspended, execution, side_effects}.
Side effects are applied by ToolRunner after collection.