Skip to main content

bob_adapters/
lib.rs

1//! # Bob Adapters
2//!
3//! Adapter implementations for the [Bob Agent Framework](https://github.com/longcipher/bob) ports.
4//!
5//! ## Overview
6//!
7//! This crate provides concrete implementations of the port traits defined in [`bob_core`]:
8//!
9//! - **LLM Adapters**: Connect to language models via various providers
10//! - **Tool Adapters**: Integrate with external tools and MCP servers
11//! - **Storage Adapters**: Persist session state
12//! - **Observability Adapters**: Log and monitor agent events
13//!
14//! ## Features
15//!
16//! All adapters are feature-gated to minimize dependencies:
17//!
18//! - **`llm-liter`** (default): LLM adapter using the [`liter-llm`](https://crates.io/crates/liter-llm)
19//!   crate
20//! - **`mcp-rmcp`** (default): Tool adapter for MCP servers via [`rmcp`](https://crates.io/crates/rmcp)
21//! - **`skills-agent`** (default): Skill loading and composition via [`bob-skills`](https://crates.io/crates/bob-skills)
22//! - **`store-memory`** (default): In-memory session storage
23//! - **`observe-tracing`** (default): Event sink using [`tracing`](https://crates.io/crates/tracing)
24//!
25//! ## Example
26//!
27//! ```rust,ignore
28//! use bob_adapters::{
29//!     llm_liter::LiterLlmAdapter,
30//!     mcp_rmcp::McpToolAdapter,
31//!     store_memory::InMemorySessionStore,
32//!     observe::TracingEventSink,
33//! };
34//! use liter_llm::{ClientConfig, DefaultClient, LlmClient};
35//! use std::sync::Arc;
36//!
37//! // LLM adapter
38//! let config = ClientConfig::new(std::env::var("OPENAI_API_KEY").unwrap_or_default());
39//! let client = Arc::new(DefaultClient::new(config, None).unwrap());
40//! let llm = LiterLlmAdapter::new(client);
41//!
42//! // Tool adapter (MCP server)
43//! let tools = McpToolAdapter::connect_stdio(
44//!     "filesystem",
45//!     "npx",
46//!     &["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
47//!     &[],
48//! ).await?;
49//!
50//! // Session store
51//! let store = InMemorySessionStore::new();
52//!
53//! // Event sink
54//! let events = TracingEventSink::new();
55//! ```
56//!
57//! ## Adapters
58//!
59//! ### LLM Adapters (`llm-liter`)
60//!
61//! Connects to LLM providers through the `liter-llm` crate, supporting:
62//! - OpenAI (GPT-4, GPT-4o-mini, etc.)
63//! - Anthropic (Claude)
64//! - Google (Gemini)
65//! - Groq
66//! - And more...
67//!
68//! ### Tool Adapters (`mcp-rmcp`)
69//!
70//! Connects to [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) servers:
71//! - Filesystem operations
72//! - Shell commands
73//! - Database queries
74//! - Custom tools
75//!
76//! ### Storage Adapters (`store-memory`)
77//!
78//! In-memory session storage for development and testing:
79//! - Fast in-process storage
80//! - No external dependencies
81//! - Suitable for single-instance deployments
82//!
83//! ### Observability (`observe-tracing`)
84//!
85//! Event sink using the `tracing` ecosystem:
86//! - Structured logging
87//! - Integration with observability tools
88//! - Configurable log levels
89//!
90//! ## Related Crates
91//!
92//! - [`bob_core`] - Domain types and ports
93//! - [`bob_runtime`] - Runtime orchestration
94//!
95//! [`bob_core`]: https://docs.rs/bob-core
96//! [`bob_runtime`]: https://docs.rs/bob-runtime
97
98pub use bob_core as core;
99
100pub mod builtin_tools;
101pub mod journal_file;
102pub mod journal_memory;
103pub mod openai_schema;
104pub mod tape_memory;
105
106#[cfg(feature = "llm-liter")]
107pub mod llm_liter;
108
109#[cfg(feature = "mcp-rmcp")]
110pub mod mcp_rmcp;
111
112#[cfg(feature = "skills-agent")]
113pub mod skills_agent;
114
115pub mod access_control;
116pub mod approval_static;
117pub mod artifact_file;
118pub mod artifact_memory;
119pub mod checkpoint_file;
120pub mod checkpoint_memory;
121pub mod cost_file;
122pub mod cost_simple;
123pub mod policy_static;
124pub mod store_file;
125pub mod store_memory;
126
127#[cfg(feature = "observe-tracing")]
128pub mod observe;
129
130#[cfg(feature = "observe-tracing")]
131pub mod provider_router;
132
133#[cfg(feature = "observe-otel")]
134pub mod observe_otel;