Expand description
§Rust Deep Agents SDK
High-performance Rust framework for composing reusable “deep” AI agents with custom tools, sub-agents, and prompts.
§Quick Start
[dependencies]
agents-sdk = "0.0.1" # Includes toolkit by defaultuse agents_sdk::{ConfigurableAgentBuilder, OpenAiConfig, OpenAiChatModel};
use agents_core::persistence::InMemoryCheckpointer;
use std::sync::Arc;
let config = OpenAiConfig::new(
std::env::var("OPENAI_API_KEY")?,
"gpt-4o-mini"
);
// Create the model
let model = Arc::new(OpenAiChatModel::new(config)?);
// Build an agent
let agent = ConfigurableAgentBuilder::new("You are a helpful assistant.")
.with_model(model)
.with_checkpointer(Arc::new(InMemoryCheckpointer::new()))
.build()?;
// Use the agent
use agents_sdk::state::AgentStateSnapshot;
use std::sync::Arc;
let response = agent.handle_message(
"Please greet Alice using the greet tool",
Arc::new(AgentStateSnapshot::default())
).await?;
println!("{:?}", response);§Features
toolkit(default): Includes agents-toolkit with built-in toolsaws: Includes AWS integrationsredis: Redis-backed state persistencepostgres: PostgreSQL-backed state persistencedynamodb: DynamoDB-backed state persistence (AWS)persistence: Grouped feature for Redis + PostgreSQLaws-full: Grouped feature for AWS + DynamoDBfull: Includes all features
§Installation Options
# Default installation with toolkit
agents-sdk = "0.0.1"
# Core only (minimal installation)
agents-sdk = { version = "0.0.1", default-features = false }
# With specific persistence backend
agents-sdk = { version = "0.0.1", features = ["redis"] }
agents-sdk = { version = "0.0.1", features = ["postgres"] }
agents-sdk = { version = "0.0.1", features = ["dynamodb"] }
# With AWS integrations
agents-sdk = { version = "0.0.1", features = ["aws-full"] }
# Everything included
agents-sdk = { version = "0.0.1", features = ["full"] }§Persistence Examples
§Redis Checkpointer
use agents_sdk::{RedisCheckpointer, ConfigurableAgentBuilder};
use std::sync::Arc;
let checkpointer = Arc::new(
RedisCheckpointer::new("redis://127.0.0.1:6379").await?
);
let agent = ConfigurableAgentBuilder::new("You are a helpful assistant")
.with_checkpointer(checkpointer)
.build()?;§PostgreSQL Checkpointer
use agents_sdk::{PostgresCheckpointer, ConfigurableAgentBuilder};
use std::sync::Arc;
let checkpointer = Arc::new(
PostgresCheckpointer::new("postgresql://user:pass@localhost/agents").await?
);
let agent = ConfigurableAgentBuilder::new("You are a helpful assistant")
.with_checkpointer(checkpointer)
.build()?;§DynamoDB Checkpointer
use agents_sdk::{DynamoDbCheckpointer, ConfigurableAgentBuilder};
use std::sync::Arc;
let checkpointer = Arc::new(
DynamoDbCheckpointer::new("agent-checkpoints").await?
);
let agent = ConfigurableAgentBuilder::new("You are a helpful assistant")
.with_checkpointer(checkpointer)
.build()?;Modules§
- agent
- builder
toolkit - Tool builder utilities for creating tools from functions
- builtin
toolkit - Built-in tools for common agent operations
- dynamodb_
checkpointer aws - DynamoDB-backed checkpointer implementation for AWS deployments.
- events
- Event system for agent lifecycle tracking and progress broadcasting
- hitl
- Human-in-the-Loop (HITL) types for agent execution interrupts.
- llm
- messaging
- persistence
- Persistence traits for checkpointing agent state between runs.
- prelude
- Prelude module for common imports
- security
- Security utilities for PII protection and data sanitization
- state
- tools
- Core tool system for AI agents
Structs§
- Anthropic
Config - Anthropic
Messages Model - Configurable
Agent Builder - Builder API to assemble a DeepAgent in a single fluent flow, mirroring the Python
create_configurable_agentexperience. Prefer this for ergonomic construction. - Deep
Agent - Core Deep Agent runtime implementation
- Dynamo
DbCheckpointer aws - DynamoDB-backed checkpointer for serverless AWS deployments.
- Dynamo
DbCheckpointer Builder aws - Builder for configuring a DynamoDB checkpointer.
- Edit
File Tool toolkit - Edit file tool - performs string replacement in a file
- Gemini
Chat Model - Gemini
Config - Hitl
Policy - LsTool
toolkit - List files tool - shows all files in the agent’s filesystem
- Open
AiChat Model - Open
AiConfig - Postgres
Checkpointer postgres - PostgreSQL-backed checkpointer with connection pooling.
- Read
File Tool toolkit - Read file tool - reads the contents of a file
- Read
Todos Tool toolkit - Read todos tool - retrieves the current todo list
- Redis
Checkpointer redis - Redis-backed checkpointer with connection pooling and TTL support.
- SubAgent
Config - Configuration for creating and registering a subagent using a simple, Python-like shape.
- Summarization
Config - Configuration for summarization middleware
- Token
Costs - Token cost configuration for different providers
- Token
Tracking Config - Configuration for token tracking middleware
- Token
Tracking Middleware - Token tracking middleware that wraps an LLM to monitor usage
- Token
Usage - Token
Usage Summary - Summary of token usage across all requests
- Tool
Builder toolkit - Builder for creating tools from async functions
- Tool
Context - Context provided to tool implementations for accessing agent state and utilities
- Tool
Parameter Schema - JSON Schema definition for tool parameters
- Tool
Registry - Tool registry for managing and discovering available tools
- Tool
Schema - Complete schema definition for a tool
- Unimplemented
Secrets Provider aws - Stub Secrets Manager provider; real implementation will sit behind the
secretsfeature. - Write
File Tool toolkit - Write file tool - creates or overwrites a file
- Write
Todos Tool toolkit - Write todos tool - updates the agent’s todo list
Enums§
- Stream
Chunk - A chunk of streaming response from the LLM
- Tool
Result - Result of a tool invocation
Traits§
- Agent
Handle - Abstraction for hosting a fully configured agent (planner + tools + prompts).
- Checkpointer
aws - Trait for persisting and retrieving agent state between conversation runs. This mirrors the LangGraph Checkpointer interface used in the Python implementation.
- Secrets
Provider aws - Placeholder trait for loading configuration secrets.
- Tool
- Core trait for tool implementations
Functions§
- create_
async_ deep_ agent - Async constructor alias to mirror the Python API surface.
- create_
deep_ agent - Create a deep agent - matches Python create_deep_agent() API exactly
- create_
filesystem_ tools toolkit - Create all filesystem tools and return them as a vec
- create_
todos_ tool toolkit - Create the todos tool (write only)
- create_
todos_ tools toolkit - Create both read and write todos tools
- get_
default_ model - Returns the default language model configured Uses OpenAI GPT-4o-mini for cost-effective operation. This model provides excellent performance at a fraction of the cost compared to larger models.
- tool
toolkit - Quick helper to create a simple async tool
- tool_
sync toolkit - Quick helper to create a simple sync tool
Type Aliases§
- Agent
Stream - Type alias for a stream of agent response chunks
- Chunk
Stream - Type alias for a pinned boxed stream of chunks
- Thread
Id aws - Unique identifier for a conversation thread/session.
- ToolBox
- Type alias for boxed tool instances
Attribute Macros§
- tool
toolkit - Converts a Rust function into an AI agent tool with automatic schema generation.