Skip to main content

nucel_agent_core/
lib.rs

1//! Nucel Agent SDK — Core
2//!
3//! Provider-agnostic traits and types for AI coding agents. Implement
4//! [`AgentExecutor`] and [`SessionImpl`] to add support for any coding-agent
5//! backend (CLI subprocess, HTTP server, in-process library, ...).
6//!
7//! Most application code should depend on the umbrella crate
8//! [`nucel-agent-sdk`](https://docs.rs/nucel-agent-sdk) rather than this
9//! crate directly. Depend on `nucel-agent-core` only if you are:
10//!
11//! - **Writing a new provider** and want the bare trait surface, or
12//! - Embedding the abstraction into something that should stay agnostic
13//!   to which providers are compiled in.
14//!
15//! # Minimal example
16//!
17//! With a real provider plugged in (see
18//! `crates/unified/examples/claude_basic.rs` in the workspace),
19//! the shape of a session is:
20//!
21//! ```rust,no_run
22//! use nucel_agent_core::{AgentExecutor, SpawnConfig};
23//! use std::path::Path;
24//! # async fn run(executor: impl AgentExecutor) -> nucel_agent_core::Result<()> {
25//! let session = executor.spawn(
26//!     Path::new("/my/repo"),
27//!     "What does this codebase do?",
28//!     &SpawnConfig { budget_usd: Some(1.0), ..Default::default() },
29//! ).await?;
30//!
31//! let resp = session.query("Now write me a one-line summary.").await?;
32//! println!("{}", resp.content);
33//! session.close().await?;
34//! # Ok(()) }
35//! ```
36//!
37//! # See also
38//!
39//! - [Workspace README](https://github.com/nucel-dev/agent-sdk#readme)
40//! - [`docs/architecture.md`](https://github.com/nucel-dev/agent-sdk/blob/main/docs/architecture.md)
41//! - [`CONTRIBUTING.md`](https://github.com/nucel-dev/agent-sdk/blob/main/CONTRIBUTING.md) — how to add a new provider.
42
43#![cfg_attr(docsrs, feature(doc_cfg))]
44
45pub mod error;
46pub mod executor;
47pub mod session;
48pub mod types;
49
50pub use error::{AgentError, Result};
51pub use executor::{
52    AgentCapabilities, AgentExecutor, AvailabilityStatus, ExecutorConfig, SpawnConfig,
53};
54pub use session::{AgentSession, EventStream, SessionImpl, SessionMetadata};
55pub use types::{
56    AgentCost, AgentResponse, CachePoint, ExecutorType, HookConfig, HookHandler, MessageEvent,
57    PermissionMode, ToolCall, ToolResult,
58};