Octoroom.Agent.ToolExecutor (octoroom_agents v0.1.0)

Copy Markdown View Source

Runs tool handlers inside the agent's process, on the app's node, so a handler can call the app directly (its Repo, PubSub, contexts).

Subvocal also had an :owner mode that sent calls to a channel process; agents run next to the app, so it isn't copied.

Summary

Functions

Runs calls and returns {results, context}, the same shape as Octoroom.Agent.ToolDispatcher.handle_calls/3. opts is accepted for compatibility and ignored.

Starts non-blocking calls and returns at once. Each handler runs in its own task, and its result is sent to :reply_to (the agent's process) as {:octoroom_agent_async_tool_result, %{call_id, name, response, scheduling, event}}.

Types

result()

@type result() :: {map(), map() | nil}

Functions

run(calls, tools, context, opts \\ [])

@spec run([map()], list(), map() | nil, keyword()) :: {[result()], map()}

Runs calls and returns {results, context}, the same shape as Octoroom.Agent.ToolDispatcher.handle_calls/3. opts is accepted for compatibility and ignored.

run_async(calls, tools, context, opts)

@spec run_async([map()], list(), map() | nil, keyword()) :: :ok

Starts non-blocking calls and returns at once. Each handler runs in its own task, and its result is sent to :reply_to (the agent's process) as {:octoroom_agent_async_tool_result, %{call_id, name, response, scheduling, event}}.