# `Jido.Messaging.Demo.ChatAgentRunner`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/demo/chat_agent_runner.ex#L1)

Wrapper that runs the ChatAgent within the Jido.Messaging AgentRunner framework.

This module bridges the Jido.AI.Agent with Jido.Messaging's agent system by:
1. Starting the ChatAgent GenServer
2. Providing a handler function for the AgentRunner
3. Managing the agent lifecycle

## Architecture

    ┌─────────────────┐
    │   AgentRunner   │  <- Subscribes to Signal Bus
    │ (per-room)      │
    └────────┬────────┘
             │ calls handler
             ▼
    ┌─────────────────┐
    │ ChatAgentRunner │  <- Manages ChatAgent lifecycle
    └────────┬────────┘
             │ delegates to
             ▼
    ┌─────────────────┐
    │   ChatAgent     │  <- ReAct reasoning + tools
    │ (GenServer)     │
    └─────────────────┘

## Usage

    # Get an agent config for use with AgentRunner
    config = ChatAgentRunner.agent_config()

    # Or start directly
    {:ok, pid} = ChatAgentRunner.start_link(room_id: "demo:lobby", ...)

# `t`

```elixir
@type t() :: %Jido.Messaging.Demo.ChatAgentRunner{
  agent_pid: pid(),
  instance_module: module(),
  room_id: binary()
}
```

# `agent_config`

Returns an agent_config map suitable for use with AgentRunner.

The handler will delegate to a running ChatAgent instance.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get_agent_pid`

Get the ChatAgent pid for direct interaction.

# `start_link`

Start the ChatAgentRunner GenServer.

This starts both the runner and the underlying ChatAgent.

---

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