Skip to main content

Module agent

Module agent 

Source
Expand description

Agent layer — sends a turn and returns a streaming event iterator.

Control requests (hook callbacks, can_use_tool) are answered by the Session itself; this layer only turns frames into AgentEvents. prompt yields the events of one turn; watch yields every turn’s, including the turns the CLI starts on its own.

Structs§

Agent
Runs turns on a Session.
TurnError
Why a turn failed. result carries cost and usage up to the failure.
TurnResult
Outcome of a finished turn, from its result frame.

Enums§

AgentError
Error starting a turn.
AgentEvent
One event of a turn, translated from the CLI’s stdout frames.

Type Aliases§

AgentStream
Events of one turn; ends after Done or Error. Dropping it before then cancels the turn (see Agent::prompt_message).