chimera-core 0.1.0

Shared traits, types, and transport for the chimera AI agent SDK
Documentation
use crate::{AgentError, Session, SessionConfig};

/// Factory for creating agent sessions.
///
/// Not object-safe (has associated types and RPITIT). Use `AgentBackend`
/// from the facade crate for runtime dispatch.
pub trait Backend: Send + Sync {
    /// Backend-specific session configuration type.
    type Config: Send + Sync + 'static;

    /// Concrete session type returned by this backend.
    type Session: Session + 'static;

    /// Backend identifier (e.g. "codex", "claude-code").
    fn name(&self) -> &'static str;

    /// Start a new agent session.
    fn session(
        &self,
        config: SessionConfig<Self::Config>,
    ) -> impl std::future::Future<Output = Result<Self::Session, AgentError>> + Send;

    /// Resume a previously saved session by ID.
    fn resume(
        &self,
        session_id: &str,
        config: SessionConfig<Self::Config>,
    ) -> impl std::future::Future<Output = Result<Self::Session, AgentError>> + Send;
}