# `Jido.Messaging.AgentSupervisor`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/agent_supervisor.ex#L1)

DynamicSupervisor for spawning and managing AgentRunner processes.

Each Jido.Messaging instance has its own AgentSupervisor that manages
agent runners on-demand.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `count_agents`

Count running agent runners for this instance

# `list_agents`

List all running agents in a room.

Returns a list of `{{thread_id, agent_id}, pid}` tuples.

# `list_all_agents`

List all running agents across all rooms

# `start_agent`

Start an agent assigned to a room thread.

Returns `{:ok, pid}` if started successfully, or `{:error, {:already_started, pid}}`
if the agent is already running in this room.

## Options

The `agent_config` map must include:
- `:handler` - Function `(message, context) -> {:reply, text} | :noreply | {:error, reason}`
- `:trigger` - `:all` | `:mention` | `{:prefix, "/cmd"}`
- `:name` - Display name for the agent

# `start_link`

# `stop_agent`

Stop an agent assigned to a room thread.

Returns `:ok` if stopped, or `{:error, :not_found}` if not running.

---

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