Crate agents_sdk

Source
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 tools
  • aws: Includes AWS integrations
  • redis: Redis-backed state persistence
  • postgres: PostgreSQL-backed state persistence
  • dynamodb: DynamoDB-backed state persistence (AWS)
  • persistence: Grouped feature for Redis + PostgreSQL
  • aws-full: Grouped feature for AWS + DynamoDB
  • full: 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§

AnthropicConfig
AnthropicMessagesModel
ConfigurableAgentBuilder
Builder API to assemble a DeepAgent in a single fluent flow, mirroring the Python create_configurable_agent experience. Prefer this for ergonomic construction.
DeepAgent
Core Deep Agent runtime implementation
DynamoDbCheckpointer
DynamoDB-backed checkpointer for serverless AWS deployments.
DynamoDbCheckpointerBuilder
Builder for configuring a DynamoDB checkpointer.
EditFileTool
Edit file tool - performs string replacement in a file
GeminiChatModel
GeminiConfig
HitlPolicy
LsTool
List files tool - shows all files in the agent’s filesystem
OpenAiChatModel
OpenAiConfig
PostgresCheckpointer
PostgreSQL-backed checkpointer with connection pooling.
ReadFileTool
Read file tool - reads the contents of a file
ReadTodosTool
Read todos tool - retrieves the current todo list
RedisCheckpointer
Redis-backed checkpointer with connection pooling and TTL support.
SubAgentConfig
Configuration for creating and registering a subagent using a simple, Python-like shape.
SummarizationConfig
Configuration for summarization middleware
ToolBuilder
Builder for creating tools from async functions
ToolContext
Context provided to tool implementations for accessing agent state and utilities
ToolParameterSchema
JSON Schema definition for tool parameters
ToolRegistry
Tool registry for managing and discovering available tools
ToolSchema
Complete schema definition for a tool
UnimplementedSecretsProvider
Stub Secrets Manager provider; real implementation will sit behind the secrets feature.
WriteFileTool
Write file tool - creates or overwrites a file
WriteTodosTool
Write todos tool - updates the agent’s todo list

Enums§

StreamChunk
A chunk of streaming response from the LLM
ToolResult
Result of a tool invocation

Traits§

AgentHandle
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.
SecretsProvider
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§

AgentStream
Type alias for a stream of agent response chunks
ChunkStream
Type alias for a pinned boxed stream of chunks
ThreadId
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.