pub struct AgentOutput {
pub content: String,
pub summary: Option<String>,
pub usage: TokenUsage,
pub finish_status: Option<FinishStatus>,
}Expand description
Structured output returned by an AgentRunner.
Why: Downstream phases need a concise summary for template substitution
while also needing the full content for file extraction. Bundling them
avoids separate trait methods. (#2683) A delegated engineer’s caller (the
PM’s delegate_to_agent tool) also needs to know whether the agent
terminated by an EXPLICIT, successful finish_task completion — that is the
authoritative “the task is genuinely done” signal used to prevent a
gratuitous post-finish re-delegation from mislabeling a complete run.
What: content is raw agent output; summary is the extracted ## Summary
section (or a prefix fallback); finish_status (#2683) is Some only when
the loop ended via an accepted finish_task call, carrying that call’s
reported status.
Test: Constructed from IPC result messages in integration paths;
finish_status propagation is covered by
agent_loop::tests::explicit_finish_task_terminates_loop_with_structured_summary
and tools::delegate::tests::completion_signal_latches_on_completed_finish.
Fields§
§content: StringRaw output from the agent.
summary: Option<String>Extracted summary (e.g. ## Summary section), if present.
usage: TokenUsageAggregated LLM token usage for this invocation.
finish_status: Option<FinishStatus>The status of an explicit finish_task completion, if the loop ended
via one (#2683). None when the run ended any other way (turn cap,
timeout, a plain no-tool-call stop, or an error).
Implementations§
Source§impl AgentOutput
impl AgentOutput
Sourcepub fn from_content(content: impl Into<String>) -> Self
pub fn from_content(content: impl Into<String>) -> Self
Build from content alone; summary/usage will be defaults.
Why: Convenience constructor for simple agent results.
What: Sets content, leaves summary None, usage zeroed, and
finish_status None (no explicit finish observed).
Test: Used in mock runners throughout this crate’s tests.
Sourcepub fn summary_or_content(&self) -> &str
pub fn summary_or_content(&self) -> &str
Return summary if present, else fall back to content.
Why: Callers that want a short form for template injection should not
have to branch on Option.
What: Returns &summary if Some, otherwise &content.
Test: agent_output_summary_or_content_fallback.
Trait Implementations§
Source§impl Clone for AgentOutput
impl Clone for AgentOutput
Auto Trait Implementations§
impl Freeze for AgentOutput
impl RefUnwindSafe for AgentOutput
impl Send for AgentOutput
impl Sync for AgentOutput
impl Unpin for AgentOutput
impl UnsafeUnpin for AgentOutput
impl UnwindSafe for AgentOutput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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