pub struct RunManager { /* private fields */ }Expand description
Coordinates run admission, in-memory state, and bounded execution.
Implementations§
Source§impl RunManager
impl RunManager
Sourcepub fn new(
executor: Arc<dyn RunExecutor>,
max_concurrent_runs: usize,
max_queued_runs: usize,
) -> Result<Self, RunManagerConfigError>
pub fn new( executor: Arc<dyn RunExecutor>, max_concurrent_runs: usize, max_queued_runs: usize, ) -> Result<Self, RunManagerConfigError>
Creates an in-memory manager. Use with_storage to enable durability.
Sourcepub fn with_storage(self, storage: Arc<dyn ExecutionStore>) -> Self
pub fn with_storage(self, storage: Arc<dyn ExecutionStore>) -> Self
Enables durable run, event, and conversation-message persistence.
pub async fn submit( &self, agent: impl Into<String>, input: impl Into<String>, history: Vec<Message>, context: ToolContext, ) -> Result<RunId, SubmitRunError>
Sourcepub async fn submit_for_task(
&self,
task_id: Uuid,
agent: impl Into<String>,
input: impl Into<String>,
history: Vec<Message>,
context: ToolContext,
) -> Result<RunId, SubmitRunError>
pub async fn submit_for_task( &self, task_id: Uuid, agent: impl Into<String>, input: impl Into<String>, history: Vec<Message>, context: ToolContext, ) -> Result<RunId, SubmitRunError>
Submits an execution on behalf of a scheduled task and records the task/run association before returning the run identifier.
pub async fn cancel( &self, run_id: RunId, ) -> Result<CancelRunOutcome, CancelRunError>
Sourcepub async fn cancel_conversation(
&self,
conversation_id: Uuid,
) -> Result<(), String>
pub async fn cancel_conversation( &self, conversation_id: Uuid, ) -> Result<(), String>
Cancels every active execution belonging to a conversation and waits until its worker has observed cancellation before returning.
pub async fn list(&self) -> Vec<Run>
Sourcepub fn subscribe_events(&self) -> Receiver<(RunId, RunEvent)>
pub fn subscribe_events(&self) -> Receiver<(RunId, RunEvent)>
Subscribe to the manager-wide live event bus. Consumers filter by run ID and load the event snapshot after subscribing to avoid missing events.
pub async fn events(&self, run_id: RunId) -> Option<Vec<RunEvent>>
pub async fn get(&self, run_id: RunId) -> Option<Run>
Sourcepub async fn task_runs(&self, task_id: Uuid) -> Result<Vec<Run>, String>
pub async fn task_runs(&self, task_id: Uuid) -> Result<Vec<Run>, String>
Lists the durable executions associated with one scheduled task.
Sourcepub async fn usage_records(
&self,
run_id: Option<RunId>,
) -> Result<Vec<UsageRecord>, String>
pub async fn usage_records( &self, run_id: Option<RunId>, ) -> Result<Vec<UsageRecord>, String>
Lists durable invocation usage, optionally restricted to one run.
Sourcepub async fn pricing_catalog(&self) -> Result<Vec<ModelPricing>, String>
pub async fn pricing_catalog(&self) -> Result<Vec<ModelPricing>, String>
Lists all registered pricing versions for the dashboard catalogue.
Sourcepub async fn register_pricing(
&self,
pricing: ModelPricing,
) -> Result<(), String>
pub async fn register_pricing( &self, pricing: ModelPricing, ) -> Result<(), String>
Registers an immutable pricing version for future cost calculations.
Sourcepub async fn pricing_for(
&self,
provider: &str,
model: &str,
) -> Result<Vec<ModelPricing>, String>
pub async fn pricing_for( &self, provider: &str, model: &str, ) -> Result<Vec<ModelPricing>, String>
Returns immutable pricing versions registered for one provider/model pair.