agents_sdk/lib.rs
1//! # Rust Deep Agents SDK
2//!
3//! High-performance Rust framework for composing reusable "deep" AI agents with custom tools,
4//! sub-agents, and prompts.
5//!
6//! ## Quick Start
7//!
8//! ```toml
9//! [dependencies]
10//! agents-sdk = "0.0.1" # Includes toolkit by default
11//! ```
12//!
13//! ```rust,no_run
14//! use agents_sdk::{ConfigurableAgentBuilder, get_default_model, create_tool};
15//! use serde_json::Value;
16//!
17//! #[tokio::main]
18//! async fn main() -> anyhow::Result<()> {
19//! // Create a simple tool
20//! let my_tool = create_tool(
21//! "greet",
22//! "Greets a person by name",
23//! |args: Value| async move {
24//! let name = args.get("name")
25//! .and_then(|v| v.as_str())
26//! .unwrap_or("World");
27//! Ok(format!("Hello, {}!", name))
28//! }
29//! );
30//!
31//! // Build an agent with the default Claude model
32//! let agent = ConfigurableAgentBuilder::new("You are a helpful assistant.")
33//! .with_model(get_default_model()?)
34//! .with_tool(my_tool)
35//! .build()?;
36//!
37//! // Use the agent
38//! use agents_sdk::state::AgentStateSnapshot;
39//! use std::sync::Arc;
40//!
41//! let response = agent.handle_message(
42//! "Please greet Alice using the greet tool",
43//! Arc::new(AgentStateSnapshot::default())
44//! ).await?;
45//! println!("{:?}", response);
46//!
47//! Ok(())
48//! }
49//! ```
50//!
51//! ## Features
52//!
53//! - `toolkit` (default): Includes agents-toolkit with built-in tools
54//! - `aws`: Includes AWS integrations (DynamoDB, Secrets Manager, etc.)
55//! - `full`: Includes all features
56//!
57//! ## Installation Options
58//!
59//! ```toml
60//! # Default installation with toolkit
61//! agents-sdk = "0.0.1"
62//!
63//! # Core only (minimal installation)
64//! agents-sdk = { version = "0.0.1", default-features = false }
65//!
66//! # With AWS integrations
67//! agents-sdk = { version = "0.0.1", features = ["aws"] }
68//!
69//! # Everything included
70//! agents-sdk = { version = "0.0.1", features = ["full"] }
71//! ```
72
73#![deny(missing_docs)]
74#![cfg_attr(docsrs, feature(doc_cfg))]
75
76// Re-export core functionality (always available)
77pub use agents_core::{agent, hitl, llm, messaging, persistence, state};
78pub use agents_runtime::{
79 create_async_deep_agent, create_deep_agent, get_default_model, ConfigurableAgentBuilder,
80 DeepAgent,
81};
82
83// Re-export toolkit functionality (when toolkit feature is enabled)
84#[cfg(feature = "toolkit")]
85#[cfg_attr(docsrs, doc(cfg(feature = "toolkit")))]
86pub use agents_toolkit::*;
87
88// Re-export AWS functionality (when aws feature is enabled)
89#[cfg(feature = "aws")]
90#[cfg_attr(docsrs, doc(cfg(feature = "aws")))]
91pub use agents_aws::*;
92
93/// Prelude module for common imports
94///
95/// ```rust
96/// use agents_sdk::prelude::*;
97/// ```
98pub mod prelude {
99
100 // Core types
101 pub use agents_core::agent::{AgentHandle, PlannerHandle, ToolHandle, ToolResponse};
102 pub use agents_core::messaging::{AgentMessage, MessageContent, MessageRole, ToolInvocation};
103 pub use agents_core::persistence::{Checkpointer, ThreadId};
104 pub use agents_core::state::AgentStateSnapshot;
105
106 // Runtime essentials
107 pub use agents_runtime::{get_default_model, ConfigurableAgentBuilder};
108
109 // Toolkit utilities (when available)
110 #[cfg(feature = "toolkit")]
111 pub use agents_toolkit::{create_sync_tool, create_tool};
112}
113
114// Convenience re-exports for the most commonly used items already handled above
115
116#[cfg(feature = "toolkit")]
117pub use agents_toolkit::{create_sync_tool, create_tool};