pub struct AgentRunner {
pub event_sender: Sender<AgentEvent>,
pub cancel_token: CancellationToken,
pub status: AgentStatus,
pub started_at: DateTime<Utc>,
pub completed_at: Option<DateTime<Utc>>,
pub last_budget_event: Option<AgentEvent>,
}Expand description
Runner that manages agent execution for a session.
Each active agent run has an associated AgentRunner that coordinates
event broadcasting, cancellation, and status tracking.
§Event Broadcasting
Uses a broadcast channel to support multiple subscribers watching the same agent run simultaneously.
§Cancellation
Provides a cancellation token that can be used to gracefully stop an in-progress agent execution.
Fields§
§event_sender: Sender<AgentEvent>Broadcast sender for agent events.
Allows multiple clients to subscribe to agent events
via event_sender.subscribe().
cancel_token: CancellationTokenCancellation token for graceful shutdown.
When triggered, the agent should stop execution at the next safe point.
status: AgentStatusCurrent status of the agent run.
started_at: DateTime<Utc>Timestamp when the run was started.
completed_at: Option<DateTime<Utc>>Timestamp when the run completed (if finished).
last_budget_event: Option<AgentEvent>Last token budget event to replay for new subscribers.
When a new client subscribes to an ongoing run, this allows them to receive the most recent token usage info.
Implementations§
Source§impl AgentRunner
impl AgentRunner
Sourcepub const EVENT_CHANNEL_CAPACITY: usize = 1000
pub const EVENT_CHANNEL_CAPACITY: usize = 1000
Broadcast channel capacity for agent events.
Sourcepub fn new() -> AgentRunner
pub fn new() -> AgentRunner
Create a new agent runner with default settings.
Initializes a broadcast channel, a fresh cancellation token,
and Pending status.
Trait Implementations§
Source§impl Clone for AgentRunner
impl Clone for AgentRunner
Source§fn clone(&self) -> AgentRunner
fn clone(&self) -> AgentRunner
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more