Skip to main content

AgentSessionEvent

Enum AgentSessionEvent 

Source
pub enum AgentSessionEvent {
Show 23 variants AgentStart, AgentEnd { messages: Vec<AgentMessage>, will_retry: bool, }, AgentSettled { aborted: bool, }, TurnStart, TurnEnd { message: AgentMessage, tool_results: Vec<ToolResultMessage>, }, MessageStart { message: AgentMessage, }, MessageUpdate { message: AgentMessage, assistant_message_event: AssistantMessageEvent, }, MessageEnd { message: AgentMessage, }, ToolExecutionStart { tool_call_id: String, tool_name: String, args: JsonObject, parent_tool_call_id: Option<String>, }, ToolExecutionUpdate { tool_call_id: String, tool_name: String, args: JsonObject, partial_result: AgentToolResult, parent_tool_call_id: Option<String>, }, ToolExecutionEnd { tool_call_id: String, tool_name: String, result: AgentToolResult, is_error: bool, duration_ms: Option<u64>, parent_tool_call_id: Option<String>, }, QueueUpdate { steering: Vec<String>, follow_up: Vec<String>, }, CompactionStart { reason: CompactionReason, }, CompactionEnd { reason: CompactionReason, result: Option<CompactionResult>, aborted: bool, will_retry: bool, error_message: Option<String>, }, EntryAppended { entry: SessionEntry, }, SessionInfoChanged { name: Option<String>, }, ThinkingLevelChanged { level: ThinkingLevel, }, AutoRetryStart { attempt: u32, max_attempts: u32, delay_ms: u64, error_message: String, }, AutoRetryEnd { success: bool, attempt: u32, final_error: Option<String>, }, SummarizationRetryScheduled { attempt: u32, max_attempts: u32, delay_ms: u64, error_message: String, }, SummarizationRetryAttemptStart { source: SummarizationSource, }, SummarizationRetryFinished, BashExecutionUpdate { id: Option<String>, delta: String, },
}
Expand description

One event emitted by an agent session.

Variants§

§

AgentStart

A run started.

§

AgentEnd

A run ended.

Fields

§messages: Vec<AgentMessage>

Messages the run added.

§will_retry: bool

An automatic retry follows.

§

AgentSettled

The session became idle after activity.

Fields

§aborted: bool

The activity was aborted.

§

TurnStart

A turn started.

§

TurnEnd

A turn ended.

Fields

§message: AgentMessage

Assistant message of the turn.

§tool_results: Vec<ToolResultMessage>

Tool results (serialised with role).

§

MessageStart

A message started.

Fields

§message: AgentMessage

The message.

§

MessageUpdate

The streaming message changed.

Fields

§message: AgentMessage

Partial message.

§assistant_message_event: AssistantMessageEvent

Provider event.

§

MessageEnd

A message is final.

Fields

§message: AgentMessage

The message.

§

ToolExecutionStart

A tool call started.

Fields

§tool_call_id: String

Tool-call id.

§tool_name: String

Tool name.

§args: JsonObject

Arguments.

§parent_tool_call_id: Option<String>

Calling tool for nested calls.

§

ToolExecutionUpdate

A tool published a partial result.

Fields

§tool_call_id: String

Tool-call id.

§tool_name: String

Tool name.

§args: JsonObject

Arguments.

§partial_result: AgentToolResult

Partial result.

§parent_tool_call_id: Option<String>

Calling tool for nested calls.

§

ToolExecutionEnd

A tool call settled.

Fields

§tool_call_id: String

Tool-call id.

§tool_name: String

Tool name.

§result: AgentToolResult

Result.

§is_error: bool

Error flag.

§duration_ms: Option<u64>

Wall time.

§parent_tool_call_id: Option<String>

Calling tool for nested calls.

§

QueueUpdate

Complete steering / follow-up queues.

Fields

§steering: Vec<String>

Steering texts.

§follow_up: Vec<String>

Follow-up texts.

§

CompactionStart

Compaction started.

Fields

§reason: CompactionReason

Trigger.

§

CompactionEnd

Compaction finished.

Fields

§reason: CompactionReason

Trigger.

§result: Option<CompactionResult>

Result (absent on failure).

§aborted: bool

Cancelled.

§will_retry: bool

The interrupted turn is retried.

§error_message: Option<String>

Failure text.

§

EntryAppended

An extension appended an entry.

Fields

§entry: SessionEntry

The entry.

§

SessionInfoChanged

The session name changed (absent = cleared).

Fields

§name: Option<String>

New name.

§

ThinkingLevelChanged

The thinking level changed.

Fields

§level: ThinkingLevel

New level.

§

AutoRetryStart

An automatic retry is scheduled.

Fields

§attempt: u32

Attempt number (1-based).

§max_attempts: u32

Retry budget.

§delay_ms: u64

Backoff delay.

§error_message: String

Error that triggered the retry.

§

AutoRetryEnd

Automatic retries ended.

Fields

§success: bool

A retry succeeded.

§attempt: u32

Last attempt number.

§final_error: Option<String>

Final error.

§

SummarizationRetryScheduled

A summarisation retry is scheduled.

Fields

§attempt: u32

Attempt number.

§max_attempts: u32

Retry budget.

§delay_ms: u64

Backoff delay.

§error_message: String

Error that triggered the retry.

§

SummarizationRetryAttemptStart

A summarisation retry attempt started.

Fields

§source: SummarizationSource

What is being summarised.

§

SummarizationRetryFinished

Summarisation retries ended.

§

BashExecutionUpdate

Streaming output of a ! command.

Fields

§id: Option<String>

Caller-supplied id.

§delta: String

Appended output.

Implementations§

Source§

impl AgentSessionEvent

Source

pub fn from_agent(event: AgentEvent, will_retry: bool) -> Self

Maps a loop event to its session event (agent_end needs will_retry).

Trait Implementations§

Source§

impl Clone for AgentSessionEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentSessionEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentSessionEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<AgentSessionEvent> for ClientEvent

Source§

fn from(event: AgentSessionEvent) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AgentSessionEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AgentSessionEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AgentSessionEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more