#[non_exhaustive]pub enum TurnEvent<'a> {
Text(&'a str),
Notice(&'a str),
Thinking(&'a str),
ToolCall {
call: &'a ToolCall,
text: &'a str,
},
ToolResult {
call: &'a ToolCall,
result: &'a ToolResult,
observation: &'a str,
text: &'a str,
},
Usage {
step: &'a Usage,
session: &'a Usage,
},
Compacted {
notice: &'a str,
summary: Option<&'a str>,
},
Ui(&'a AgentMessage),
}Expand description
One thing a running turn reports. Each event carries the text that run and the
plain REPL stream for it, so every surface sees the same output.
#[non_exhaustive] (since 1.2.0, ADR 0004): later releases add kinds of event,
so a match outside this crate needs a _ arm. TurnEvent::text is what any
event adds to the turn’s output, whatever its kind.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(&'a str)
The model’s text (or the ingress guardrail’s refusal, which stands in for it).
Notice(&'a str)
A notice from the harness ([cancelled], [guardrail] ..., a continuation or
compaction note): part of the output, but never part of the answer, so run
can keep it off stdout.
Thinking(&'a str)
A piece of the model’s reasoning, already redacted. Not part of the turn’s output: only the interface shows it.
ToolCall
A tool call, announced before its batch runs; text is its [tool] name(...) line.
ToolResult
A call’s result, in call order. observation is what the model is shown, after
the observation guardrail; text is the [tool] name -> summary line.
Usage
Beyond Python: a model call finished. step is what it used; session is
the session’s usage with it added (sub-agents’ spend joins when their batch
ends). Adds nothing to the turn’s output.
Compacted
The history was compacted: notice is what the other surfaces stream (a
notice, as before), and summary the summary written, None when it could
not be and the history was trimmed instead (beyond Python: an editor shows it
as ACP’s compaction_update).
Ui(&'a AgentMessage)
Beyond Python (ADR 0005): one A2UI message a render_ui call drew,
validated, for the surface to draw. Sent after the call’s ToolCall and
before its ToolResult, in order. Adds nothing to the turn’s output.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for TurnEvent<'a>
impl<'a> Freeze for TurnEvent<'a>
impl<'a> Move for TurnEvent<'a>
impl<'a> RefUnwindSafe for TurnEvent<'a>
impl<'a> Send for TurnEvent<'a>
impl<'a> Sync for TurnEvent<'a>
impl<'a> Unpin for TurnEvent<'a>
impl<'a> UnsafeUnpin for TurnEvent<'a>
impl<'a> UnwindSafe for TurnEvent<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more