Skip to main content

aonyx_agent/
lib.rs

1//! # aonyx-agent
2//!
3//! The agent loop and its inner subsystems.
4//!
5//! ## Subsystems
6//! - [`runner`] — the main `AgentRunner::run(session, msg)` loop.
7//! - [`compaction`] — context-window pressure monitor + summarization triggers.
8//! - [`classifier`] — routes user input to a prompt template (chitchat / task / recall / code / research).
9//! - [`approval`] — gate around destructive tool calls.
10//! - [`subagent`] — spawn isolated child agents with a whitelisted tool set (V2).
11//!
12//! ## Loop sketch
13//! ```text
14//! loop {
15//!   inject(skills_active(query, project));
16//!   inject(memory_recall(query, k=10));
17//!   chunks = llm.chat_stream(messages, tools).await;
18//!   for tool_call in chunks.tool_calls() {
19//!       approval.check(tool_call)?;
20//!       result = tools.invoke(tool_call).await?;
21//!       messages.push(result);
22//!   }
23//!   if chunks.no_tool_call() { break; }
24//! }
25//! post_turn::maybe_diary_append();
26//! post_turn::maybe_kg_upsert();
27//! ```
28
29#![forbid(unsafe_code)]
30#![warn(missing_docs, rust_2018_idioms)]
31
32pub mod approval;
33pub mod classifier;
34pub mod compaction;
35pub mod runner;
36pub mod subagent;
37
38pub use approval::ApprovalPolicy;
39pub use runner::{AgentRunner, TurnEvent, TurnResult};