Skip to main content

Module event

Module event 

Source
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

TypeRole
AgentEventStream of events emitted by the agent loop (text deltas, tool results, status…)
AgentInputInput that starts or resumes an agent session
TurnStatusResult of one iteration: Done, ToolCalls, Continue, or Interrupted
TurnUsageToken usage reported at the end of an LLM call
SourceWeb source attached to a tool result (URL + optional title)

§Event flow

  1. Text arrives incrementally as AgentEvent::TextDelta (and AgentEvent::ReasoningDelta)
  2. Tool execution produces AgentEvent::ToolStart → AgentEvent::ToolResult
  3. File modifications produce AgentEvent::FileDiff
  4. The turn ends with AgentEvent::Done or AgentEvent::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).
TurnUsage
Token usage reported at the end of an LLM call.

Enums§

AgentEvent
Events emitted by the agent turn loop as a Stream<Item = AgentEvent>.
AgentInput
Input that starts or resumes an agent session.
CompactionReason
Why compaction is needed after a turn.
TurnStatus
Result of a single agent turn after the LLM has responded.

Type Aliases§

TurnResult
Alias for the final result of a turn.