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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! # agnt
//!
//! A dense, sync-first Rust agent engine. Multi-backend LLM inference
//! with streaming, parallel tool dispatch, SQLite session persistence,
//! and microsecond-level tool profiling — no async runtime required.
//! Around 6,000 LOC across seven crates as of v0.3.1; see the repository
//! README for the live breakdown.
//!
//! ## Quick start
//!
//! ```no_run
//! use agnt::{Agent, Backend};
//!
//! let backend = Backend::ollama("gemma4:e4b");
//! let mut agent = Agent::new(backend, "You are a helpful assistant.");
//! # #[cfg(feature = "tools")]
//! agent.tools.register(Box::new(agnt::builtins::ReadFile::new()));
//!
//! let reply = agent.step("Read /etc/hostname and tell me the hostname.").unwrap();
//! println!("{}", reply);
//! ```
//!
//! ## Architecture (v0.3.1 — seven-crate workspace)
//!
//! The flagship `agnt` crate is a thin re-export over six underlying
//! library crates. Everything is feature-gated so consumers can pick
//! the slice they need — WASM / embedded callers depend only on
//! `agnt-core`.
//!
//! - [`agnt-core`](https://crates.io/crates/agnt-core) — traits, types,
//! agent loop, quotas, observer hooks. Zero I/O dependencies.
//! - [`agnt-net`](https://crates.io/crates/agnt-net) — HTTP backend
//! implementation (Ollama / OpenAI / Anthropic). `net` feature.
//! - [`agnt-store`](https://crates.io/crates/agnt-store) — SQLite
//! message store with µs-precision tool log. `store` feature.
//! - [`agnt-tools`](https://crates.io/crates/agnt-tools) — built-in
//! tools with filesystem sandbox, atomic SSRF-guarded Fetch, and
//! opt-in Shell (plus `bwrap-shell` on Linux). `tools` feature.
//! - [`agnt-macros`](https://crates.io/crates/agnt-macros) — `#[tool]`
//! attribute macro. `macros` feature (default on).
//! - [`agnt-mcp`](https://crates.io/crates/agnt-mcp) — MCP stdio
//! client. `mcp` feature (off by default).
//!
//! `default = ["net", "store", "tools", "macros"]` gives you the
//! working runtime from a single `cargo add agnt`. Opt in to `mcp`
//! and `tools-bwrap-shell` as needed.
//!
//! ## Design principles
//!
//! 1. **Sync-first.** No tokio required. Tool dispatch uses
//! [`std::thread::scope`] for parallelism without an async runtime.
//! 2. **Structurally sandboxed.** Filesystem root, atomic SSRF
//! resolver, opt-in Shell, optional bubblewrap — each layer is
//! designed assuming the LLM output is hostile.
//! 3. **Multi-backend from day one.** One internal `Message` type;
//! providers translate at the wire boundary.
//! 4. **Auditable by module.** Security-critical paths (agent loop,
//! tools, sandbox, SSRF resolver, MCP framing) each live in a
//! single small file so reviewers can read them in isolation.
//!
//! See the [README](https://github.com/hmbldv/agnt) for benchmarks, the
//! current threat model, and the roadmap.
// Core types and traits — always re-exported.
pub use ;
pub use ToolQuota;
/// Alias the agent loop module for explicit access.
/// Alias the tool module for explicit access.
// Network backend — feature-gated.
pub use Backend;
// Persistence — feature-gated.
pub use Store;
// Built-in tools — feature-gated.
// Sandbox primitive, re-exported at the flagship crate root so consumers
// don't have to pull `agnt-tools` directly for the most common
// sandbox-aware tool construction pattern (`ReadFile::with_sandbox(Arc<…>)`).
// Added in v0.3.2 after SOLA became the first real downstream consumer
// and surfaced the ergonomic gap.
pub use FilesystemRoot;
// v0.3: #[tool] proc-macro. Feature-gated so crates that want a minimal
// agnt-core footprint can skip the proc-macro compile cost.
pub use tool;
// v0.3: MCP stdio client + Tool bridge. Feature-gated because the average
// user doesn't need it and it pulls in child-process plumbing.