agent-kernel 0.1.0

Minimal Agent orchestration kernel for multi-agent discussion
Documentation
//! Agent kernel crate — minimal orchestration primitives for multi-agent discussion.
//!
//! # Design Principles (pi-mono)
//! - Extreme minimalism: `discuss()` is the ONLY orchestration primitive
//! - Full trust: caller controls `rounds`, no internal policy
//! - Observability first: `AgentEvent` is a first-class output via `mpsc::Sender`
//! - Late binding: `Message` stays internal until provider converts at the boundary
//!
//! # Phase 2 additions (independent repo)
//! - `evolution` module: `EvolutionContext` + `EvolutionRuntime` trait
//! - `AgentEvent::Evolved` variant in `event` module
//!
//! # Quick Start
//!
//! ```rust,no_run
//! use agent_kernel::{Agent, AgentRuntime, BoxFuture, discuss};
//! use tokio::sync::mpsc;
//! use tokio_util::sync::CancellationToken;
//!
//! struct MyRuntime;
//!
//! impl AgentRuntime for MyRuntime {
//!     fn respond<'a>(
//!         &'a self,
//!         agent: &'a Agent,
//!         _history: &'a [agent_kernel::Message],
//!     ) -> BoxFuture<'a, anyhow::Result<String>> {
//!         Box::pin(async move {
//!             Ok(format!("[{}] My response", agent.name))
//!         })
//!     }
//! }
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//!     let runtime = MyRuntime;
//!     let agents = vec![
//!         Agent { name: "alice".into(), soul_md: "You are Alice.".into(), model: "gpt-4o".into() },
//!         Agent { name: "bob".into(), soul_md: "You are Bob.".into(), model: "gpt-4o".into() },
//!     ];
//!     let (tx, mut rx) = mpsc::channel(64);
//!     let cancel = CancellationToken::new();
//!     let summary = discuss(&runtime, &agents, "What is Rust?", 2, cancel, tx).await?;
//!     while let Ok(event) = rx.try_recv() {
//!         println!("{event:?}");
//!     }
//!     println!("Summary: {summary}");
//!     Ok(())
//! }
//! ```

pub mod agent;
pub mod discuss;
pub mod event;
pub mod evolution;
pub mod message;
pub mod runtime;

/// Boxed future used as [`AgentRuntime::respond`] return type.
///
/// Using an explicit `BoxFuture` instead of `async_trait` keeps the kernel
/// dependency-free (no `async_trait` macro crate required).
pub type BoxFuture<'a, T> = std::pin::Pin<Box<dyn std::future::Future<Output = T> + Send + 'a>>;

// ── Re-exports ────────────────────────────────────────────────────────────────

pub use agent::Agent;
pub use event::AgentEvent;
pub use evolution::{EvolutionContext, EvolutionRuntime};
pub use message::{Message, Role};
pub use runtime::AgentRuntime;
pub use discuss::discuss;