# `Octoroom.Agent.ToolExecutor`
[🔗](https://github.com/samrat/octoroom/blob/v0.1.0/agents/lib/octoroom/agent/tool_executor.ex#L1)

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.

# `result`

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

# `run`

```elixir
@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`

```elixir
@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}}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
