1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! # AgentDB
//!
//! A single-file embedded database for AI agents.
//!
//! **Eight layers, one file, zero servers:**
//!
//! | Layer | What it gives you |
//! |---|---|
//! | Relational SQL (SQLite) | Full SQL engine, ACID, WAL, user-defined tables |
//! | HNSW Vector Search | ANN search, cosine/euclidean/dot, batch upsert |
//! | Memory Graph (recursive CTE) | Typed nodes, weighted edges, recursive CTE traversal |
//! | FTS5 Full-Text Search | FTS5 virtual tables, BM25 ranking, Porter stemmer |
//! | Hybrid Graph + Vector Queries | Graph traversal + vector ANN with alpha blending |
//! | Conversations | Threaded message history with role and metadata |
//! | Workflow Persistence | Durable multi-step agent workflow state |
//! | Reasoning Traces | Structured chain-of-thought and trace logging |
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use agentdb::{AgentDB, VectorEntry, SearchOptions, DistanceMetric};
//! use serde_json::json;
//!
//! let db = AgentDB::open(":memory:").unwrap();
//!
//! // SQL
//! db.execute("CREATE TABLE sessions (id TEXT PRIMARY KEY)").unwrap();
//!
//! // Vectors
//! let col = db.vectors().collection("thoughts", 4).unwrap();
//! col.upsert(VectorEntry {
//! id: "t1".into(),
//! vector: vec![0.9, 0.1, 0.0, 0.0],
//! metadata: Some(json!({ "score": 9 })),
//! }).unwrap();
//!
//! // Memory graph
//! let graph = db.memory();
//! graph.add_node("s1", "session", None).unwrap();
//! graph.add_node("t1", "thought", None).unwrap();
//! graph.add_edge("s1", "t1", "recalled", 0.9).unwrap();
//!
//! // Stats
//! let stats = db.stats().unwrap();
//! println!("nodes={} edges={}", stats.nodes, stats.edges);
//! ```
//!
//! ## Feature flags
//!
//! | Flag | What it enables |
//! |---|---|
//! | `async` | Tokio async runtime wrappers |
//! | `ffi` | C FFI flat API (`extern "C"` functions in `src/ffi.rs`) |
//! | `python` | PyO3 Python bindings (enables `ffi`) |
//! | `wasm` | WASM/wasm-bindgen target |
pub use ;
pub use ;
pub use ;
pub use matches as filter_matches;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;