Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Send + Sync {
    type Config: Send + Sync + 'static;
    type Session: Session + 'static;

    // Required methods
    fn name(&self) -> &'static str;
    fn capabilities(&self) -> BackendCapabilities;
    fn session(
        &self,
        config: SessionConfig<Self::Config>,
    ) -> impl Future<Output = Result<Self::Session, AgentError>> + Send;
    fn resume(
        &self,
        session_id: &str,
        config: SessionConfig<Self::Config>,
    ) -> impl Future<Output = Result<Self::Session, AgentError>> + Send;
}
Expand description

Factory for creating agent sessions.

Not object-safe (has associated types and RPITIT). Use AgentBackend from the facade crate for runtime dispatch.

Required Associated Types§

Source

type Config: Send + Sync + 'static

Backend-specific session configuration type.

Source

type Session: Session + 'static

Concrete session type returned by this backend.

Required Methods§

Source

fn name(&self) -> &'static str

Backend identifier (e.g. “codex”, “claude-code”).

Source

fn capabilities(&self) -> BackendCapabilities

Backend feature support exposed by this implementation.

This reports backend-level support. For config-dependent behavior, callers should consult the backend config’s own capabilities() helper when available.

Source

fn session( &self, config: SessionConfig<Self::Config>, ) -> impl Future<Output = Result<Self::Session, AgentError>> + Send

Start a new agent session.

Source

fn resume( &self, session_id: &str, config: SessionConfig<Self::Config>, ) -> impl Future<Output = Result<Self::Session, AgentError>> + Send

Resume a previously saved session by ID.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§