pub struct Yielded<'a, 'h, Ctx: LoopDepth + Send + Sync + 'static> {
pub tool_calls: Vec<ToolCall>,
pub results: Vec<ToolResult>,
pub assistant_content: Vec<ContentBlock>,
pub iteration: u32,
pub total_usage: Usage,
/* private fields */
}Expand description
Handle returned when tools were executed. Borrows the ToolLoopHandle
mutably, so the caller cannot call next_turn() again until this is
consumed via resume(), continue_loop(), inject_and_continue(), or
stop().
The text content the LLM produced alongside tool calls is available
directly via assistant_content and
assistant_text() — no need to scan
messages().
Fields§
§tool_calls: Vec<ToolCall>The tool calls the LLM requested.
results: Vec<ToolResult>Results from executing those tool calls.
assistant_content: Vec<ContentBlock>Text content from the LLM’s response alongside the tool calls.
This is the other_content from partition_content() — Text,
Reasoning, Image, etc. — everything that isn’t a ToolCall or
ToolResult. Previously only accessible by scanning messages().
iteration: u32Current iteration number (1-indexed).
total_usage: UsageAccumulated usage across all iterations so far.
Implementations§
Source§impl<'a, 'h, Ctx: LoopDepth + Send + Sync + 'static> Yielded<'a, 'h, Ctx>
impl<'a, 'h, Ctx: LoopDepth + Send + Sync + 'static> Yielded<'a, 'h, Ctx>
Sourcepub fn resume(self, command: LoopCommand)
pub fn resume(self, command: LoopCommand)
Continue with the given command.
Sourcepub fn continue_loop(self)
pub fn continue_loop(self)
Convenience: continue to the next LLM iteration with no injected messages.
Sourcepub fn inject_and_continue(self, messages: Vec<ChatMessage>)
pub fn inject_and_continue(self, messages: Vec<ChatMessage>)
Convenience: inject messages and continue.
Sourcepub fn assistant_text(&self) -> Option<String>
pub fn assistant_text(&self) -> Option<String>
Extract text from assistant_content blocks.
Returns the LLM’s “thinking aloud” text emitted alongside tool calls,
or None if there were no text blocks.
Sourcepub fn messages(&self) -> &[ChatMessage]
pub fn messages(&self) -> &[ChatMessage]
Access the full message history (read-only).
Sourcepub fn messages_mut(&mut self) -> &mut Vec<ChatMessage>
pub fn messages_mut(&mut self) -> &mut Vec<ChatMessage>
Access the full message history (mutable, for context compaction).