pub struct AgentRuntime { /* private fields */ }Implementations§
Source§impl AgentRuntime
impl AgentRuntime
Sourcepub fn new(
model: Arc<dyn AgentModel>,
tools: Arc<dyn ToolDispatcher>,
policy: Arc<dyn PolicyEngine>,
) -> Self
pub fn new( model: Arc<dyn AgentModel>, tools: Arc<dyn ToolDispatcher>, policy: Arc<dyn PolicyEngine>, ) -> Self
Creates a runtime using a fixed model (useful for tests and embedding).
Sourcepub fn new_with_router(
model_router: Arc<dyn ModelRouter>,
tools: Arc<dyn ToolDispatcher>,
policy: Arc<dyn PolicyEngine>,
) -> Self
pub fn new_with_router( model_router: Arc<dyn ModelRouter>, tools: Arc<dyn ToolDispatcher>, policy: Arc<dyn PolicyEngine>, ) -> Self
Creates a runtime whose model is selected independently for each turn.
pub fn with_event_sink(self, event_sink: Arc<dyn EventSink>) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sourcepub fn with_tool_timeout(self, timeout: Duration) -> Self
pub fn with_tool_timeout(self, timeout: Duration) -> Self
Sets the maximum duration of an individual tool invocation.
A timed-out tool future is dropped and its timeout is returned to the model as a tool error. This does not undo external side effects.
Sourcepub fn with_max_tool_output_bytes(self, max_bytes: usize) -> Self
pub fn with_max_tool_output_bytes(self, max_bytes: usize) -> Self
Sets the maximum number of UTF-8 bytes retained from each tool result.
Sourcepub async fn run_with_event_sink(
&self,
run_id: Uuid,
agent: &Agent,
context: ToolContext,
messages: Vec<Message>,
input: impl Into<String>,
cancellation: CancellationToken,
event_sink: Arc<dyn EventSink>,
) -> Result<RunResult, RunFailure>
pub async fn run_with_event_sink( &self, run_id: Uuid, agent: &Agent, context: ToolContext, messages: Vec<Message>, input: impl Into<String>, cancellation: CancellationToken, event_sink: Arc<dyn EventSink>, ) -> Result<RunResult, RunFailure>
Runs an agent while forwarding each emitted runtime event to an additional sink.
The runtime’s configured sink remains active; the supplied sink is composed with it so existing observers continue to receive events.
Sourcepub async fn run(
&self,
run_id: Uuid,
agent: &Agent,
context: ToolContext,
messages: Vec<Message>,
input: impl Into<String>,
cancellation: CancellationToken,
) -> Result<RunResult, RunFailure>
pub async fn run( &self, run_id: Uuid, agent: &Agent, context: ToolContext, messages: Vec<Message>, input: impl Into<String>, cancellation: CancellationToken, ) -> Result<RunResult, RunFailure>
Runs an agent with trusted platform context and optional conversation history.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AgentRuntime
impl !UnwindSafe for AgentRuntime
impl Freeze for AgentRuntime
impl Send for AgentRuntime
impl Sync for AgentRuntime
impl Unpin for AgentRuntime
impl UnsafeUnpin for AgentRuntime
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