pub struct AgentRuntime<P: ChatProvider, S = Idle> { /* private fields */ }Expand description
AgentRuntime owns the shared infrastructure (LLM client, tool registry,
tool executor) and a persistent session (backed by a session actor).
The generic parameter S is a type-state marker — Idle means
no send/send_stream is in progress, Acquired means one is active.
Send operations consume AgentRuntime<P, Idle> and return a handle that
eventually yields back AgentRuntime<P, Idle>.
Implementations§
Source§impl<P: ChatProvider, S> AgentRuntime<P, S>
impl<P: ChatProvider, S> AgentRuntime<P, S>
Sourcepub fn builder() -> AgentRuntimeBuilder
pub fn builder() -> AgentRuntimeBuilder
Create a new builder.
Sourcepub fn session_tx(&self) -> UnboundedSender<SessionCmd>
pub fn session_tx(&self) -> UnboundedSender<SessionCmd>
Access the session control channel.
Sourcepub fn max_iterations(&self) -> usize
pub fn max_iterations(&self) -> usize
Maximum ReAct iterations per call.
Sourcepub fn channel_buffer(&self) -> usize
pub fn channel_buffer(&self) -> usize
Channel buffer size.
Sourcepub fn subscribe_env_state(&self) -> Receiver<EnvStateEvent>
pub fn subscribe_env_state(&self) -> Receiver<EnvStateEvent>
Subscribe to runtime-level environment state events.
The returned receiver yields EnvStateEvent notifications about
tool/skill registration changes, LLM model changes, etc. that occur
during the runtime’s lifetime.
Unlike Agent::subscribe_raw_events
which only delivers events during a fire/send call, this subscription
is persistent and independent of any agent call.
Sourcepub fn tool_registry(&self) -> Arc<RwLock<ToolRegistry>> ⓘ
pub fn tool_registry(&self) -> Arc<RwLock<ToolRegistry>> ⓘ
The tool registry (for dynamic tool management).