bob-core 0.2.0

Core domain types and port traits for Bob Agent Framework
Documentation

bob-core

crates.io docs.rs License

Core domain types and port traits for the Bob Agent Framework.

Overview

bob-core defines the hexagonal boundary of the Bob Agent Framework using the ports and adapters architecture pattern. This crate contains:

  • Domain Types: Core data structures used throughout the framework
  • Port Traits: Abstract interfaces that adapters must implement
  • Error Types: Comprehensive error definitions for all components

This crate intentionally contains no concrete implementations — only contracts.

Architecture

The crate defines four primary port traits:

  1. LlmPort - Interface for language model interactions
  2. ToolPort - Interface for tool/system operations
  3. SessionStore - Interface for session state persistence
  4. EventSink - Interface for event observation and logging

Usage

Add this to your Cargo.toml:

[dependencies]
bob-core = "0.1"

Example: Implementing a Custom LLM Adapter

use bob_core::{
    ports::LlmPort,
    types::{LlmRequest, LlmResponse, LlmStream},
    error::LlmError,
};
use async_trait::async_trait;

struct MyCustomLlm;

#[async_trait]
impl LlmPort for MyCustomLlm {
    async fn complete(&self, req: LlmRequest) -> Result<LlmResponse, LlmError> {
        // Your implementation here
        todo!("implement LLM completion")
    }

    async fn complete_stream(&self, req: LlmRequest) -> Result<LlmStream, LlmError> {
        // Your implementation here
        todo!("implement streaming completion")
    }
}

Features

  • Zero-cost abstractions: All traits use async_trait for async support
  • Type-safe: Strong typing throughout with comprehensive error handling
  • Serializable: All domain types implement serde::Serialize and Deserialize
  • Thread-safe: All traits require Send + Sync

Documentation

Full API documentation is available at docs.rs/bob-core.

Related Crates

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.