Skip to main content

SubagentResult

Struct SubagentResult 

Source
pub struct SubagentResult {
    pub status: Option<String>,
    pub prompt: Option<String>,
    pub agent_id: Option<String>,
    pub agent_type: Option<String>,
    pub content: Vec<ContentBlock>,
    pub resolved_model: Option<String>,
    pub total_duration_ms: Option<u64>,
    pub total_tokens: Option<u64>,
    pub total_tool_use_count: Option<u64>,
    pub usage: Option<UsageInfo>,
    pub tool_stats: Option<SubagentToolStats>,
}
Expand description

Token, timing, and tool-use accounting for a completed subagent (Task) run.

The Claude CLI echoes this object in the tool_use_result of a Task tool’s result message. It is the typed source of truth for subagent token attribution: the per-run total_tokens, total_duration_ms, and total_tool_use_count correspond to the subagent_tokens / duration_ms / tool_uses line items the CLI renders in its human-readable <usage> block, and usage carries the full per-model token breakdown for the run.

Fields§

§status: Option<String>

Completion status of the subagent run (e.g. "completed").

§prompt: Option<String>

The prompt the subagent was launched with.

§agent_id: Option<String>

Stable identifier of the spawned subagent.

§agent_type: Option<String>

Subagent type that ran (e.g. general-purpose, Explore).

§content: Vec<ContentBlock>

Final content blocks the subagent returned.

§resolved_model: Option<String>

Model the subagent actually resolved to (e.g. claude-sonnet-4-6).

§total_duration_ms: Option<u64>

Wall-clock duration of the subagent run, in milliseconds.

§total_tokens: Option<u64>

Total tokens consumed by the subagent — the subagent_tokens rollup line.

§total_tool_use_count: Option<u64>

Number of tool invocations the subagent made.

§usage: Option<UsageInfo>

Detailed token / cache usage for the subagent run.

§tool_stats: Option<SubagentToolStats>

Per-category tool-use counts, present for some agent types (e.g. Explore).

Trait Implementations§

Source§

impl Clone for SubagentResult

Source§

fn clone(&self) -> SubagentResult

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 SubagentResult

Source§

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

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

impl<'de> Deserialize<'de> for SubagentResult

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 Serialize for SubagentResult

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

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, 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.