pub struct ToolExecutor { /* private fields */ }Expand description
Tool executor with workspace sandboxing
This is the main entry point for tool execution. It wraps the ToolRegistry.
Implementations§
Source§impl ToolExecutor
impl ToolExecutor
pub fn new(workspace: String) -> Self
pub fn new_with_artifact_limits( workspace: String, artifact_limits: ArtifactStoreLimits, ) -> Self
pub fn new_with_workspace_services( workspace: String, workspace_services: Arc<WorkspaceServices>, ) -> Self
pub fn new_with_workspace_services_and_artifact_limits( workspace: String, workspace_services: Arc<WorkspaceServices>, artifact_limits: ArtifactStoreLimits, ) -> Self
pub fn workspace(&self) -> &PathBuf
pub fn registry(&self) -> &Arc<ToolRegistry> ⓘ
Sourcepub fn get_artifact(&self, artifact_uri: &str) -> Option<ToolArtifact>
pub fn get_artifact(&self, artifact_uri: &str) -> Option<ToolArtifact>
Get a stored tool artifact by URI.
Sourcepub fn artifact_store(&self) -> ArtifactStore
pub fn artifact_store(&self) -> ArtifactStore
Return a clone of the executor’s artifact store handle.
Sourcepub fn set_trace_sink(&self, sink: Arc<dyn TraceSink>)
pub fn set_trace_sink(&self, sink: Arc<dyn TraceSink>)
Replace the sink used for compact execution trace events.
Sourcepub fn trace_sink(&self) -> Arc<dyn TraceSink> ⓘ
pub fn trace_sink(&self) -> Arc<dyn TraceSink> ⓘ
Return the currently configured execution trace sink.
pub fn command_env(&self) -> Option<Arc<HashMap<String, String>>>
pub fn register_dynamic_tool(&self, tool: Arc<dyn Tool>)
pub fn unregister_dynamic_tool(&self, name: &str)
Sourcepub fn unregister_tools_by_prefix(&self, prefix: &str)
pub fn unregister_tools_by_prefix(&self, prefix: &str)
Unregister all dynamic tools whose names start with the given prefix.
Sourcepub fn register_program_catalog(&self, catalog: ProgramCatalog)
pub fn register_program_catalog(&self, catalog: ProgramCatalog)
Replace the model-visible program tool with a custom PTC catalog.
Sourcepub async fn execute(&self, name: &str, args: &Value) -> Result<ToolResult>
pub async fn execute(&self, name: &str, args: &Value) -> Result<ToolResult>
Execute directly against this low-level executor.
This API intentionally does not install agent/session permission, HITL,
hook, budget, queue, timeout, cancellation, or sanitization policy.
Session hosts should use crate::AgentSession::tool (or its typed
helpers), and agent runtimes must dispatch through their scoped tool
invocation gateway.
Sourcepub async fn execute_with_context(
&self,
name: &str,
args: &Value,
ctx: &ToolContext,
) -> Result<ToolResult>
pub async fn execute_with_context( &self, name: &str, args: &Value, ctx: &ToolContext, ) -> Result<ToolResult>
Execute directly with a caller-owned context.
Like Self::execute, this is an ungoverned standalone boundary. A
ToolContext supplies capabilities to the tool but is not itself a
substitute for the agent/session invocation gateway.
pub fn definitions(&self) -> Vec<ToolDefinition>
Auto Trait Implementations§
impl Freeze for ToolExecutor
impl RefUnwindSafe for ToolExecutor
impl Send for ToolExecutor
impl Sync for ToolExecutor
impl Unpin for ToolExecutor
impl UnsafeUnpin for ToolExecutor
impl UnwindSafe for ToolExecutor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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