pub struct ManagedCustomTool { /* private fields */ }Expand description
Wrapper for custom (client-executed) tools declared in a ManagedAgentDef.
When the Runner’s agent calls execute(), this tool returns a pending status
and signals is_long_running() = true. This causes the agent loop to break
after the current turn, yielding control back to the session loop. The session
loop then emits agent.custom_tool_use to notify the client and parks via
the ToolParkingLot until the client
delivers a result through user.custom_tool_result.
§Multi-Turn Flow
- LLM returns a function call for this custom tool
- Agent calls
execute()→ returns pending status is_long_running() = truebreaks the agent loop- Session loop sees the custom tool call in emitted events
- Session loop emits
agent.custom_tool_use, setsRequiresActionstop reason - Session loop parks until client delivers via
user.custom_tool_result - On next turn, the delivered result is available for the agent
Implementations§
Trait Implementations§
Source§impl Clone for ManagedCustomTool
impl Clone for ManagedCustomTool
Source§fn clone(&self) -> ManagedCustomTool
fn clone(&self) -> ManagedCustomTool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ManagedCustomTool
impl Debug for ManagedCustomTool
Source§impl Tool for ManagedCustomTool
impl Tool for ManagedCustomTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns a human-readable description of what this tool does.
Source§fn parameters_schema(&self) -> Option<Value>
fn parameters_schema(&self) -> Option<Value>
Returns the JSON Schema for this tool’s parameters, if any.
Source§fn is_long_running(&self) -> bool
fn is_long_running(&self) -> bool
Indicates whether the tool is a long-running operation.
Long-running tools typically return a task ID immediately and
complete the operation asynchronously.
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ToolContext>,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
_ctx: Arc<dyn ToolContext>,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes the tool with the given context and arguments.
Source§fn declaration(&self) -> Value
fn declaration(&self) -> Value
Returns the tool declaration that should be exposed to model providers. Read more
Source§fn enhanced_description(&self) -> String
fn enhanced_description(&self) -> String
Returns an enhanced description that may include additional notes.
For long-running tools, this includes a warning not to call the tool
again if it has already returned a pending status.
Default implementation returns the base description.
Source§fn is_builtin(&self) -> bool
fn is_builtin(&self) -> bool
Indicates whether this tool is a built-in server-side tool (e.g.,
google_search, url_context). Read moreSource§fn response_schema(&self) -> Option<Value>
fn response_schema(&self) -> Option<Value>
Returns the JSON Schema for this tool’s response, if any.
Source§fn required_scopes(&self) -> &[&str]
fn required_scopes(&self) -> &[&str]
Returns the scopes required to execute this tool. Read more
Source§fn is_read_only(&self) -> bool
fn is_read_only(&self) -> bool
Indicates whether this tool performs no side effects.
Read-only tools may be executed concurrently in Auto mode.
Source§fn is_concurrency_safe(&self) -> bool
fn is_concurrency_safe(&self) -> bool
Indicates whether this tool is safe for concurrent execution.
Used by the Parallel strategy to validate dispatch safety.
Auto Trait Implementations§
impl Freeze for ManagedCustomTool
impl RefUnwindSafe for ManagedCustomTool
impl Send for ManagedCustomTool
impl Sync for ManagedCustomTool
impl Unpin for ManagedCustomTool
impl UnsafeUnpin for ManagedCustomTool
impl UnwindSafe for ManagedCustomTool
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