Skip to main content

ExternalChildRunner

Trait ExternalChildRunner 

Source
pub trait ExternalChildRunner: Send + Sync {
    // Required methods
    fn should_handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 Session,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute_external_child<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session: &'life1 mut Session,
        job: &'life2 SpawnJob,
        event_tx: Sender<AgentEvent>,
        cancel_token: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn set_ticket_service(&self, _service: Option<Arc<TicketService>>) { ... }
    fn validate_required_child_context_route<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _session: &'life1 Session,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn prepare_durable_child_delivery<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _session: &'life1 Session,
        _activation_run_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn commit_durable_child_delivery<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _session: &'life1 Session,
        _activation_run_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn confirm_durable_child_delivery<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _session: &'life1 Session,
        _activation_run_id: &'life2 str,
        _history_committed: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn set_escalation_bridge(&self, _bridge: Option<HostBridge>) { ... }
    fn set_session_inbox_runtime(
        &self,
        _binding: Option<SessionInboxRuntimeBinding>,
    ) { ... }
    fn set_actor_directory_store(&self, _store: Option<Arc<SessionStoreV2>>) { ... }
    fn set_canonical_subagent_tool(&self, _tool: Option<Arc<dyn Tool>>) { ... }
    fn set_actor_event_observer(
        &self,
        _observer: Option<Arc<dyn ActorEventObserver>>,
    ) { ... }
}
Expand description

Trait for external child session runtimes (e.g. A2A, CLI adapters).

Implementors are responsible for emitting AgentEvents via event_tx and respecting the cancel_token.

Required Methods§

Source

fn should_handle<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 Session, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns true if this runner should handle the given child session.

Source

fn execute_external_child<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session: &'life1 mut Session, job: &'life2 SpawnJob, event_tx: Sender<AgentEvent>, cancel_token: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute the child session using an external runtime.

Provided Methods§

Source

fn set_ticket_service(&self, _service: Option<Arc<TicketService>>)

Opt-in, host-owned scope authority. It is never copied into the Worker.

Source

fn validate_required_child_context_route<'life0, 'life1, 'async_trait>( &'life0 self, _session: &'life1 Session, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A narrow, pre-persistence compatibility check on the actual registered runner. Unknown/custom routes fail closed for required one-shot packets.

Source

fn prepare_durable_child_delivery<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _session: &'life1 Session, _activation_run_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist a Host-only broker receipt before the final Child checkpoint. Ok(true) selects the append-safe final checkpoint. An unprepared broker terminal must never be ACKed after a merely ordinary save.

Source

fn commit_durable_child_delivery<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _session: &'life1 Session, _activation_run_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Commit and read back any Host-only proof required for this terminal delivery after the final Child Session save. Failure (including timeout) prevents a committed completion source and successful runner finalization. When the source is pending, publish its terminal status and seal with an exact-snapshot canonical write before returning; the SDK verifies readback. Legacy/default runners need no separate proof and retain save-only behavior.

Source

fn confirm_durable_child_delivery<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _session: &'life1 Session, _activation_run_id: &'life2 str, _history_committed: bool, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

ACK transport delivery only after the final Child save and required Host proof commit both succeed. The exact Child birth and activation run identify the pending receipt; failed commitment leaves it unacknowledged. ACK delivery failure does not invalidate an already-proven completion.

Source

fn set_escalation_bridge(&self, _bridge: Option<HostBridge>)

Bind this runner’s per-run escalation host bridge (#68). A nested worker’s run() installs its OWN host bridge here so the runner can hand it to each grandchild’s drive() AT SPAWN time (captured into the drive task, not read later), letting the grandchild re-proxy a non-bypass approval request UP to its parent run for its whole lifetime — even when it outlives the run that spawned it. Default no-op for runners that don’t escalate (e.g. A2A).

Source

fn set_session_inbox_runtime( &self, _binding: Option<SessionInboxRuntimeBinding>, )

Bind the owning runtime’s canonical SessionInbox resources. Actor runners use this to bridge active local/remote/warm workers without a process-global live-session registry.

Source

fn set_actor_directory_store(&self, _store: Option<Arc<SessionStoreV2>>)

Optional actual host Store for the local zero-tool named-profile route. This does not enable owned Inbox claims or grant authority to custom runners.

Source

fn set_canonical_subagent_tool(&self, _tool: Option<Arc<dyn Tool>>)

Bind the application-owned logical SubAgent tool after its canonical scheduler/adapter exist. Actor runners use it only for fenced child RPCs.

Source

fn set_actor_event_observer( &self, _observer: Option<Arc<dyn ActorEventObserver>>, )

Optional host-owned, redacted canonical Actor event observer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§