# Events

Real-time event stream — monitor every agent, every tool call, every session from one connection.

The daemon broadcasts agent events in real time. Subscribe from any client and see everything — text deltas, tool calls, completions — across all agents and all sessions simultaneously.

## [Subscribing](/content/docs/crabtalk/events#subscribing/index.html)

Send a `SubscribeEvents` message to the daemon. You'll receive a stream of `AgentEventMsg` objects, each carrying:

| Field       | Description                                        |
| ----------- | -------------------------------------------------- |
| `agent`     | Which agent produced the event                     |
| `session`   | Which session it belongs to                        |
| `kind`      | Event type (see below)                            |
| `content`   | Event payload                                     |
| `timestamp` | When it happened                                   |

## [Event kinds](/content/docs/crabtalk/events#event-kinds/index.html)

| Kind           | What happened                                   |
| -------------- | ----------------------------------------------- |
| `TEXT_DELTA`  | Agent is generating text                        |
| `THINKING_DELTA` | Agent is reasoning (thinking mode)           |
| `TOOL_START`  | Agent dispatched tool call(s)                   |
| `TOOL_RESULT` | A tool call completed                            |
| `TOOLS_COMPLETE` | All pending tool calls finished               |
| `DONE`        | Agent turn completed                             |

## [Streaming events](/content/docs/crabtalk/events#streaming-events/index.html)

When you stream a single request (via `StreamMsg`), you get richer typed events:

| Event               | What it carries                                  |
| ------------------- | ------------------------------------------------ |
| `StreamStart`      | Agent name + session ID                          |
| `StreamChunk`      | Text delta                                      |
| `StreamThinking`   | Reasoning delta                                  |
| `ToolStartEvent`   | Array of tool calls being dispatched             |
| `ToolResultEvent`  | Single result with `call_id` and `duration_ms` |
| `ToolsCompleteEvent`| All tools finished                              |
| `AskUserEvent`     | Agent needs input — questions with options      |
| `StreamEnd`        | Final — agent, error, provider, model, token usage |

Tool calls arrive as a batch in `ToolStartEvent`. Results stream back individually as each completes — you see which tool is slow without waiting for the entire batch.

## [Use cases](/content/docs/crabtalk/events#use-cases/index.html)

- **Dashboard**: show all active agents and their current state
- **Debugging**: watch tool calls execute in real time
- **Logging**: pipe events to a file or external system
- **Monitoring**: alert when an agent errors or exceeds duration

## [Protocol](/content/docs/crabtalk/events#protocol/index.html)

| Operation       | Message           | Response                   |
| ---------------- | ------------------| --------------------------- |
| Subscribe        | `SubscribeEvents` | Stream of `AgentEventMsg`  |
| Stream request   | `StreamMsg`      | Stream of `StreamEvent`    |

See [Protocol](/content/docs/crabtalk/protocol/index.html) for the full wire format.

## [What's next](/content/docs/crabtalk/events#whats-next/index.html)

- [Protocol](/content/docs/crabtalk/protocol/index.html) — the complete wire protocol
- [Agents](/content/docs/crabtalk/agents/index.html) — the agents producing events
- [Scheduled Tasks](/content/docs/crabtalk/cron/index.html) — events from cron-triggered runs

### On this page

- [Subscribing](/content/docs/crabtalk/events#subscribing/index.html)
- [Event kinds](/content/docs/crabtalk/events#event-kinds/index.html)
- [Streaming events](/content/docs/crabtalk/events#streaming-events/index.html)
- [Use cases](/content/docs/crabtalk/events#use-cases/index.html)
- [Protocol](/content/docs/crabtalk/events#protocol/index.html)
- [What's next](/content/docs/crabtalk/events#whats-next/index.html)
