Skip to main content

AgentTool

Struct AgentTool 

Source
pub struct AgentTool { /* private fields */ }
Expand description

A tool that runs an agent in a child runner over a fresh in-memory session and returns its final answer.

Implementations§

Source§

impl AgentTool

Source

pub fn new(agent: Arc<dyn Agent>, cfg: Option<AgentToolConfig>) -> Arc<dyn Tool> ⓘ

Wraps agent as a tool; None means skip_summarization = false.

Trait Implementations§

Source§

impl RunnableTool for AgentTool

Source§

fn run<'life0, 'async_trait>( &'life0 self, ctx: Context, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Runs the wrapped agent in a child runner and returns its final answer under result.

Source§

impl Tool for AgentTool

Source§

fn declaration(&self) -> Option<FunctionDeclaration>

The agent’s function declaration (see make_function_declaration).

Source§

fn display_result_on_skip_summarization(&self) -> bool

With skip summarization the sub-agent’s result is the final answer, so it is still shown to the user.

Source§

fn origin_kind(&self) -> ToolOriginKind

Classified as SubAgent (A2A when its agent is remote).

Source§

fn origin_agent(&self) -> Option<Arc<dyn Agent>>

The wrapped agent.

Source§

fn name(&self) -> &str

The name of the tool.
Source§

fn description(&self) -> &str

A description of the tool.
Source§

fn as_runnable(&self) -> Option<&dyn RunnableTool>

The runnable capability.
Source§

fn as_any(&self) -> &dyn Any

Downcasting support.
Source§

fn is_long_running(&self) -> bool

Whether the tool is a long-running operation, which typically returns a resource id first and finishes the operation later.
Source§

fn process_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 Context, _req: &'life2 mut LlmRequest, ) -> Pin<Box<dyn Future<Output = Result<(), ToolError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Extra request edits only. The flow packs a tool that has a declaration with pack_tool before this runs; a tool without one is never packed. Async because implementations may do I/O (artifact listing, memory search).
Source§

fn as_streaming(&self) -> Option<&dyn StreamingTool>

The streaming capability.
Source§

fn defers_response(&self) -> bool

Whether the tool defers its response: an empty result is then not sent to the model.
Source§

fn wrapper_key(&self) -> Option<&str>

The finish_task wrapper key.
Source§

fn unwrap(&self) -> Option<Arc<dyn Tool>>

The tool this one wraps, for a confirmation or delegating wrapper (the agent-analytics plugin reaches the wrapped tool through it). None for a tool that wraps nothing.
Source§

fn origin_agents(&self) -> Vec<Arc<dyn Agent>>

Every agent the tool can hand a call to, in order, for analytics (e.g. a transfer tool’s supported agents). Defaults to origin_agent as a list of at most one.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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