Skip to main content

AgentSession

Trait AgentSession 

Source
pub trait AgentSession: Send {
    // Required methods
    fn capabilities(&self) -> &InterventionCapabilities;
    fn events(&mut self) -> BoxStream<'static, ActivityEvent>;
    fn intervene<'life0, 'async_trait>(
        &'life0 self,
        cmd: InterventionCommand,
    ) -> Pin<Box<dyn Future<Output = Result<(), HarnessError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn wait_result<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<Payload, HarnessError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

A live agent run for one activity attempt.

Produced by AgentHarness::start. Exposes the negotiated capability set, a stream of neutral events OUT, a neutral command sink IN, and a single terminal result.

Required Methods§

Source

fn capabilities(&self) -> &InterventionCapabilities

The capability set negotiated at start.

The server and ops console gate on THIS, never on harness identity. An empty set is a first-class advertisement — an observability-only harness supports no interventions.

Source

fn events(&mut self) -> BoxStream<'static, ActivityEvent>

The stream of neutral events produced by this run.

Every item is an ActivityEvent; how the adapter derives them (mapping a structured notification, or demuxing interleaved stdout into mostly aion_core::ActivityEventKind::Raw) is an adapter-internal detail invisible here.

Source

fn intervene<'life0, 'async_trait>( &'life0 self, cmd: InterventionCommand, ) -> Pin<Box<dyn Future<Output = Result<(), HarnessError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delivers a neutral intervention command into the running agent.

A session whose advertised Self::capabilities set does not contain the command’s primitive rejects it with HarnessError::CapabilityNotSupported. An observability-only session (empty set) rejects every command this way; the server never routes one to it because the advertised set is empty.

§Errors

Returns HarnessError::CapabilityNotSupported when the command’s primitive is not advertised, HarnessError::StaleTarget when the command targets a superseded attempt, or a transport/protocol error when delivery fails.

Source

fn wait_result<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<Payload, HarnessError>> + Send + 'async_trait>>
where Self: 'async_trait,

Awaits the single terminal result of the run.

Consumes the session: exactly one terminal result is produced per attempt, and it is the replay-authoritative activity output the worker captures.

§Errors

Returns HarnessError::Harness when the run reported an application-level failure, or a transport/protocol error when the terminal result could not be received.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§