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 default
use agents_sdk::{ConfigurableAgentBuilder, OpenAiConfig};
use agents_core::persistence::InMemoryCheckpointer;
use std::sync::Arc;
let config = OpenAiConfig::new(
std::env::var("OPENAI_API_KEY")?,
"gpt-4o-mini"
);
// Build an agent
let agent = ConfigurableAgentBuilder::new("You are a helpful assistant.")
.with_openai_chat(config)?
.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
- Tool builder utilities for creating tools from functions
- builtin
- Built-in tools for common agent operations
- dynamodb_
checkpointer - DynamoDB-backed checkpointer implementation for AWS deployments.
- 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
- 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_agent
experience. Prefer this for ergonomic construction. - Deep
Agent - Core Deep Agent runtime implementation
- Dynamo
DbCheckpointer - DynamoDB-backed checkpointer for serverless AWS deployments.
- Dynamo
DbCheckpointer Builder - Builder for configuring a DynamoDB checkpointer.
- Edit
File Tool - Edit file tool - performs string replacement in a file
- Gemini
Chat Model - Gemini
Config - Hitl
Policy - LsTool
- List files tool - shows all files in the agent’s filesystem
- Open
AiChat Model - Open
AiConfig - Postgres
Checkpointer - PostgreSQL-backed checkpointer with connection pooling.
- Read
File Tool - Read file tool - reads the contents of a file
- Read
Todos Tool - Read todos tool - retrieves the current todo list
- Redis
Checkpointer - 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
- Tool
Builder - 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 - Stub Secrets Manager provider; real implementation will sit behind the
secrets
feature. - Write
File Tool - Write file tool - creates or overwrites a file
- Write
Todos Tool - 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
- Trait for persisting and retrieving agent state between conversation runs. This mirrors the LangGraph Checkpointer interface used in the Python implementation.
- Secrets
Provider - 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 - Create all filesystem tools and return them as a vec
- create_
todos_ tool - Create the todos tool (write only)
- create_
todos_ tools - 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
- Quick helper to create a simple async tool
- tool_
sync - 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 - Unique identifier for a conversation thread/session.
- ToolBox
- Type alias for boxed tool instances
Attribute Macros§
- tool
- Converts a Rust function into an AI agent tool with automatic schema generation.