Skip to main content

AgentThreadHost

Trait AgentThreadHost 

Source
pub trait AgentThreadHost: Send + Sync {
    // Required methods
    fn spawn<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
        request: AgentSpawnRequest,
    ) -> Pin<Box<dyn Future<Output = Result<AgentThread>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn spawn_remote<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
        request: RemoteAgentSpawnRequest,
    ) -> Pin<Box<dyn Future<Output = Result<AgentThread>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
        request: SendAgentMessageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<InterAgentMessage>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_thread<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
        thread_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<AgentThread>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_threads<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentThread>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn subscribe_thread<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
        thread_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<AgentHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn interrupt<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 AgentControlScope,
        thread_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<AgentInterruptReceipt>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn subscribe_first_turn<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _scope: &'life1 AgentControlScope,
        _thread_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<AgentHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Mandatory trusted-host operations shared by the native tools and adapters. Implementations must recheck live authority at the mutation boundary, persist before publishing, intersect child policy, enforce tree/root budgets, retain exact host bindings, and route all approvals to the root. Mutation lifetimes must not become untracked merely because a tool caller drops its future.

This contract deliberately supplies no implementation that fabricates child execution, approval, delivery, completion, or cancellation.

Required Methods§

Source

fn spawn<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, request: AgentSpawnRequest, ) -> Pin<Box<dyn Future<Output = Result<AgentThread>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn spawn_remote<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, request: RemoteAgentSpawnRequest, ) -> Pin<Box<dyn Future<Output = Result<AgentThread>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn send_message<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, request: SendAgentMessageRequest, ) -> Pin<Box<dyn Future<Output = Result<InterAgentMessage>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn load_thread<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, thread_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<AgentThread>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn list_threads<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentThread>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn subscribe_thread<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, thread_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AgentHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn interrupt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 AgentControlScope, thread_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AgentInterruptReceipt>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provided Methods§

Source

fn subscribe_first_turn<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _scope: &'life1 AgentControlScope, _thread_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AgentHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Subscribe to the first invocation’s retained result, not latest state. Hosts without a receipt cannot substitute a later resumed turn.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§