pub struct AgentTool { /* private fields */ }Expand description
A Tool that runs a child Agent on a task and returns its answer.
use autumn_plugin_agent::delegate::AgentTool;
use autumn_plugin_agent::tools::ToolEffect;
let researcher = Agent::new(Arc::clone(&client))
.system_prompt("You research one question and answer in five lines.")
.max_steps(6);
let tool = AgentTool::new(
"research",
"Research one question in depth and return a short answer.",
researcher,
)
.effect(ToolEffect::ReadOnly);
let parent = Agent::new(client).tool(Arc::new(tool));Implementations§
Source§impl AgentTool
impl AgentTool
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
agent: Agent,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, agent: Agent, ) -> Self
Wrap agent as a tool. The model calls it with {"task": "..."}.
Sourcepub const fn effect(self, effect: ToolEffect) -> Self
pub const fn effect(self, effect: ToolEffect) -> Self
Declare the strongest effect among the child’s tools. The default is
ToolEffect::Write.
Trait Implementations§
Source§impl Tool for AgentTool
impl Tool for AgentTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
What the tool does, shown to the model.
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON Schema for the tool’s input object.
Source§fn effect(&self) -> ToolEffect
fn effect(&self) -> ToolEffect
What the tool can change. Defaults to
ToolEffect::Write: a tool
is trusted with less only when it says so.Source§fn execute<'a>(
&'a self,
input: Value,
_ctx: &'a ToolContext,
) -> Pin<Box<dyn Future<Output = Result<Value, AgentError>> + Send + 'a>>
fn execute<'a>( &'a self, input: Value, _ctx: &'a ToolContext, ) -> Pin<Box<dyn Future<Output = Result<Value, AgentError>> + Send + 'a>>
Run the tool against decoded JSON arguments.
Source§fn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
Bundle the metadata the model sees into a
ToolDefinition.Auto Trait Implementations§
impl !RefUnwindSafe for AgentTool
impl !UnwindSafe for AgentTool
impl Forget for AgentTool
impl Freeze for AgentTool
impl Send for AgentTool
impl Sync for AgentTool
impl Unpin for AgentTool
impl UnsafeUnpin for AgentTool
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
Open a deferred
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.