pub struct AgentResult {
pub is_error: bool,
pub result_text: String,
pub input_tokens: Option<u64>,
pub output_tokens: Option<u64>,
pub cost_usd: Option<f64>,
pub duration_ms: Option<u64>,
pub truncated_by_length: bool,
}Expand description
Structured result from per-agent NDJSON extraction.
Each agent emits a different NDJSON format. The per-agent find_result
functions parse agent-specific envelopes and return a unified AgentResult
so callers (review pipeline, response handler) don’t need format knowledge.
Fields§
§is_error: boolWhether the agent reported an error (e.g. is_error: true in Claude).
result_text: StringThe extracted result text (inner content, stripped of envelope).
input_tokens: Option<u64>Input tokens consumed (if reported by the agent).
output_tokens: Option<u64>Output tokens consumed (if reported by the agent).
cost_usd: Option<f64>Total cost in USD (if reported by the agent).
duration_ms: Option<u64>Wall-clock duration in milliseconds (if reported by the agent).
truncated_by_length: boolTrue when the provider cut the response short by exceeding its
output/reasoning token budget (e.g. opencode’s step_finish event
reporting reason: "length"), as opposed to producing malformed
output. Callers use this to distinguish a token-budget fluke from a
genuinely format-incapable model.
Trait Implementations§
Source§impl Clone for AgentResult
impl Clone for AgentResult
Auto Trait Implementations§
impl Freeze for AgentResult
impl RefUnwindSafe for AgentResult
impl Send for AgentResult
impl Sync for AgentResult
impl Unpin for AgentResult
impl UnsafeUnpin for AgentResult
impl UnwindSafe for AgentResult
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