pub struct Runtime { /* private fields */ }Expand description
The central runtime orchestrator.
Connects the sans-IO state machine to real I/O: model providers, tool execution, memory management, and approval workflows.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(
tools: Arc<ToolRegistry>,
memory: Arc<dyn ConversationMemory>,
) -> Self
pub fn new( tools: Arc<ToolRegistry>, memory: Arc<dyn ConversationMemory>, ) -> Self
Creates a new runtime with default configuration.
The runtime is parameterized by:
tools: registry of callable toolsmemory: conversation memory backend
Sourcepub fn with_config(self, config: RuntimeConfig) -> Self
pub fn with_config(self, config: RuntimeConfig) -> Self
Sets the runtime configuration.
Sourcepub fn with_approval_gate(self, gate: Arc<ApprovalGate>) -> Self
pub fn with_approval_gate(self, gate: Arc<ApprovalGate>) -> Self
Sets the approval gate.
Sourcepub fn subscribe(&self) -> Receiver<AgentEvent>
pub fn subscribe(&self) -> Receiver<AgentEvent>
Subscribes to runtime events.
Sourcepub async fn run(
&self,
provider: &(dyn ChatProvider + Sync),
session_id: &str,
user_id: &str,
user_message: &str,
system_prompt: Option<&str>,
) -> RuntimeResult<RunOutput>
pub async fn run( &self, provider: &(dyn ChatProvider + Sync), session_id: &str, user_id: &str, user_message: &str, system_prompt: Option<&str>, ) -> RuntimeResult<RunOutput>
Runs an agent execution loop.
Takes a user message text, builds context, and drives the sans-IO state machine until completion or error.
§Errors
Returns RuntimeError if the provider fails unrecoverably or
the run is aborted.
Auto Trait Implementations§
impl !RefUnwindSafe for Runtime
impl !UnwindSafe for Runtime
impl Freeze for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
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