Expand description
Telemetry and control events for the agent turn loop.
This module defines the event types and input structures that flow through the agent runtime during each turn.
§Key types
| Type | Role |
|---|---|
AgentEvent | Stream of events emitted by the agent loop (text deltas, tool results, status…) |
AgentInput | Input that starts or resumes an agent session |
TurnStatus | Result of one iteration: Done, ToolCalls, Continue, or Interrupted |
TurnUsage | Token usage reported at the end of an LLM call |
Source | Web source attached to a tool result (URL + optional title) |
§Event flow
- Text arrives incrementally as
AgentEvent::TextDelta(andAgentEvent::ReasoningDelta) - Tool execution produces
AgentEvent::ToolStart→AgentEvent::ToolResult - File modifications produce
AgentEvent::FileDiff - The turn ends with
AgentEvent::DoneorAgentEvent::Error
Listeners (REPL, Telegram, Slack, etc.) receive the event stream and render incrementally. Unknown variants should be silently ignored for forward compatibility.
Structs§
- Source
- A web source attached to a tool result (e.g. search result link).
- Turn
Usage - Token usage reported at the end of an LLM call.
Enums§
- Agent
Event - Events emitted by the agent turn loop as a
Stream<Item = AgentEvent>. - Agent
Input - Input that starts or resumes an agent session.
- Compaction
Reason - Why compaction is needed after a turn.
- Turn
Status - Result of a single agent turn after the LLM has responded.
Type Aliases§
- Turn
Result - Alias for the final result of a turn.