SkillKit.Agent.ToolRunner (SkillKit v0.1.0)

Copy Markdown View Source

DynamicSupervisor for tool call execution. Public API for batch tool execution via execute_all/2.

Each tool call runs as a supervised child in parallel. Results and side effects are collected and applied to state sequentially after all children complete.

Suspended tools block their child process until SkillKit.respond/3 delivers the answer. The child registers itself in the agent's Registry so respond can route directly to it. execute_all naturally blocks until every child has a resolved result.

Uses :temporary restart strategy — children are not restarted on crash. Crashed children produce error results.

Summary

Functions

Returns a specification to start this module under a supervisor.

Executes a batch of tool calls in parallel under supervised children.

Starts a supervised child task under this runner.

Starts the ToolRunner supervisor for the given agent.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

execute_all(state, tool_calls)

Executes a batch of tool calls in parallel under supervised children.

Each tool call runs in its own child process. If a tool suspends ({:pending, state}), the child blocks until an answer arrives via SkillKit.respond/3. Returns only when every tool has a resolved result.

State is the first argument for pipelining.

start_child(runner, fun)

@spec start_child(pid() | GenServer.name(), (-> any())) ::
  {:ok, pid()} | {:error, term()}

Starts a supervised child task under this runner.

start_link(agent)

@spec start_link(SkillKit.Agent.t()) :: Supervisor.on_start()

Starts the ToolRunner supervisor for the given agent.