AgentOrchestrator

Struct AgentOrchestrator 

Source
pub struct AgentOrchestrator<M: OrchestratorAgentManager> { /* private fields */ }
Expand description

Orchestrator for coordinating subagents and delegated task execution.

The orchestrator is core-owned and does not depend on Tauri. GUI/CLI layers can attach an OrchestratorObserver to receive lifecycle events.

Implementations§

Source§

impl<M: OrchestratorAgentManager> AgentOrchestrator<M>

Source

pub async fn list_environments( &self, run_id: Option<&str>, ) -> Vec<EnvironmentRecord>

Source

pub async fn get_environment( &self, environment_id: &str, ) -> Option<EnvironmentRecord>

Source

pub async fn retry_environment_preparation( &self, environment_id: &str, ) -> Result<EnvironmentRecord, String>

Source

pub async fn cleanup_environment( &self, environment_id: &str, archive_if_dirty: bool, ) -> Result<EnvironmentRecord, String>

Source§

impl<M: OrchestratorAgentManager> AgentOrchestrator<M>

Source§

impl<M: OrchestratorAgentManager> AgentOrchestrator<M>

Source

pub fn new(agent_manager: M, config: AppConfig) -> Self

Create a new orchestrator with the given agent manager and application config.

Source

pub fn new_with_workspace_root( agent_manager: M, config: AppConfig, default_workspace_dir: Option<PathBuf>, ) -> Self

Create a new orchestrator with an explicit workspace root for persisted state.

Source

pub async fn set_observer(&self, observer: Arc<dyn OrchestratorObserver>)

Attach an observer used for adapter-side event emission.

This is intentionally async and uses interior mutability so adapters (GUI/CLI) can attach observers after construction (e.g., once a Tauri AppHandle exists) without requiring &mut self.

Source

pub async fn clear_observer(&self)

Remove any attached observer.

Source

pub async fn spawn_subagent(&self, id: &str, name: &str) -> Result<(), String>

Spawn and register a new subagent.

Source

pub async fn spawn_subagent_with_request( &self, request: AgentSpawnRequest, ) -> Result<(), String>

Spawn and register a subagent using an explicit specialist configuration.

Source

pub async fn delegate_task(&self, task: DelegatedTask) -> Result<String, String>

Delegate a task to a subagent.

  • Ensures the target agent exists (spawning a default one if needed)
  • Enforces tool permission checks
  • Executes the task asynchronously via the unified pipeline
Source

pub async fn create_child_supervisor_run( &self, request: ChildSupervisorRunRequest, ) -> Result<SupervisorRun, String>

Create a direct child supervisor run under an existing parent run.

Source

pub async fn poll_result(&self) -> Option<TaskResult>

Get the result of a completed task if one is ready.

Source

pub async fn list_active_tasks(&self) -> Vec<DelegatedTask>

Get list of currently active tasks.

Source

pub async fn list_active_task_snapshots(&self) -> Vec<ActiveTaskSnapshot>

Get live active-task snapshots enriched with mirrored execution telemetry.

Source

pub async fn list_supervisor_runs(&self) -> Vec<SupervisorRun>

List live and persisted supervisor runs known to the orchestrator.

Source

pub async fn list_root_supervisor_runs(&self) -> Vec<SupervisorRun>

List only root supervisor runs (child runs excluded from the top-level list).

Source

pub async fn list_child_supervisor_runs( &self, parent_run_id: &str, ) -> Vec<SupervisorRun>

List child supervisor runs for a specific parent run.

Source

pub async fn get_supervisor_run_ancestry( &self, run_id: &str, ) -> Vec<SupervisorRun>

Return the ancestor chain for a run, ordered from root to immediate parent.

Source

pub async fn get_supervisor_run_descendants( &self, run_id: &str, ) -> Vec<SupervisorRun>

Return all descendants beneath a run (bounded to one level for now).

Source

pub async fn list_supervisor_leaf_tasks( &self, run_id: &str, ) -> Vec<SupervisorTaskRecord>

Return leaf tasks visible beneath a run, including direct children.

Source

pub async fn get_supervisor_run(&self, run_id: &str) -> Option<SupervisorRun>

Fetch a supervisor run by id.

Source

pub async fn list_team_messages(&self, run_id: &str) -> Vec<TeamMessage>

List team messages for a run.

Source

pub async fn list_team_threads(&self, run_id: &str) -> Vec<TeamThread>

List grouped collaboration threads for a run.

Source

pub async fn list_team_threads_with_options( &self, run_id: &str, include_archived: bool, ) -> Vec<TeamThread>

List grouped collaboration threads for a run with archive controls.

Source

pub async fn list_subagents(&self) -> Vec<AgentInfo>

List all running subagents.

Source

pub async fn approve_task( &self, task_id: &str, actor: ApprovalActor, note: Option<String>, ) -> Result<(), String>

Approve a task before execution or after a review/test gate.

Source

pub async fn reject_task( &self, task_id: &str, actor: ApprovalActor, note: Option<String>, ) -> Result<(), String>

Reject or request revision for a delegated task.

Source

pub async fn retry_task(&self, task_id: &str) -> Result<(), String>

Retry a task that previously failed or was blocked.

Source

pub async fn resume_task_from_checkpoint( &self, task_id: &str, ) -> Result<(), String>

Resume a blocked workflow task from its latest persisted checkpoint.

Source

pub async fn restart_task_from_scratch( &self, task_id: &str, ) -> Result<(), String>

Restart a workflow task from scratch and discard any saved checkpoint resume state.

Source

pub async fn acknowledge_blocked_task( &self, task_id: &str, note: Option<String>, ) -> Result<(), String>

Record that an operator acknowledged a blocked workflow task without resuming it.

Source

pub async fn claim_task( &self, task_id: &str, agent_id: &str, ) -> Result<(), String>

Claim ownership of a queued task for an agent.

Source

pub async fn send_team_message( &self, run_id: &str, task_id: Option<String>, kind: TeamMessageKind, sender_agent_id: Option<String>, recipient_agent_id: Option<String>, content: impl Into<String>, ) -> Result<TeamMessage, String>

Record a structured team message.

Source

pub async fn send_team_message_draft( &self, run_id: &str, draft: TeamMessageDraft, ) -> Result<TeamMessage, String>

Record a structured collaboration message using the richer draft payload.

Source

pub async fn update_team_thread_action( &self, run_id: &str, thread_id: &str, status: CollaborationActionStatus, actor_id: Option<String>, note: Option<String>, ) -> Result<TeamThread, String>

Update the latest actionable request in a collaboration thread.

Source

pub async fn archive_team_thread( &self, run_id: &str, thread_id: &str, actor_id: Option<String>, note: Option<String>, ) -> Result<TeamThread, String>

Archive an existing collaboration thread.

Source

pub async fn cancel_task(&self, task_id: &str) -> Result<(), String>

Cancel a running task.

Source

pub async fn pause_task(&self, task_id: &str) -> Result<(), String>

Pause a running local delegated task and preserve resumable checkpoint state.

Source

pub async fn shutdown_all(&self, grace_secs: u64)

Shutdown all subagents gracefully.

Trait Implementations§

Source§

impl<M: Clone + OrchestratorAgentManager> Clone for AgentOrchestrator<M>

Source§

fn clone(&self) -> AgentOrchestrator<M>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<M> Freeze for AgentOrchestrator<M>
where M: Freeze,

§

impl<M> !RefUnwindSafe for AgentOrchestrator<M>

§

impl<M> Send for AgentOrchestrator<M>

§

impl<M> Sync for AgentOrchestrator<M>

§

impl<M> Unpin for AgentOrchestrator<M>
where M: Unpin,

§

impl<M> !UnwindSafe for AgentOrchestrator<M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,