strands-agents

Crates.iostrands-agents
lib.rsstrands-agents
version0.1.0
created_at2025-12-23 07:40:23.844022+00
updated_at2025-12-23 07:40:23.844022+00
descriptionA Rust implementation of the Strands AI Agents SDK
homepage
repositoryhttps://github.com/peitaosu/strands-rs
max_upload_size
id2000966
size772,379
PT (peitaosu)

documentation

README

Strands Agents

A Rust implementation of the Strands Agents SDK for building AI agents with model-driven orchestration.

Crates.io Documentation License

Features

  • Model-Driven Orchestration — Agents use LLM reasoning to plan, execute tools, and iterate
  • Multi-Provider Support — AWS Bedrock, OpenAI, Anthropic, Ollama, and more
  • Type-Safe Tools — Define tools with the #[tool] macro
  • Multi-Agent Patterns — Graph and Swarm orchestration
  • Async-First — Built on Tokio with streaming support
  • OpenTelemetry Integration — Built-in tracing and metrics

Installation

[dependencies]
strands-agents = "0.1"
tokio = { version = "1", features = ["full"] }

Quick Start

use strands_agents::prelude::*;
use strands_agents::models::BedrockModel;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut agent = Agent::builder()
        .model(BedrockModel::new("anthropic.claude-3-sonnet-20240229-v1:0").await?)
        .system_prompt("You are a helpful assistant")
        .build()?;

    let result = agent.invoke_async("Hello!").await?;
    println!("{}", result);
    Ok(())
}

Tools

use strands_agents::{tool, Agent};
use strands_agents::models::BedrockModel;

#[tool]
/// Get current weather for a location.
async fn get_weather(location: String) -> String {
    format!("Weather in {location}: 72°F, Sunny")
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut agent = Agent::builder()
        .model(BedrockModel::default().await?)
        .tool(GetWeatherTool::new())?
        .build()?;

    let result = agent.invoke_async("What's the weather in Seattle?").await?;
    println!("{}", result);
    Ok(())
}

Cargo Features

Feature Description
macros #[tool] procedural macro (default)
s3-session S3-based session persistence
otel-stdout OpenTelemetry stdout exporter
otel-otlp OpenTelemetry OTLP exporter
otel All OpenTelemetry exporters
full All features

Modules

Module Description
agent Core Agent interface
models Model providers (Bedrock, OpenAI, Anthropic, Ollama, etc.)
tools Tool definition, execution, and MCP support
multiagent Graph and Swarm patterns
hooks Lifecycle hooks
session Session persistence
conversation Context window management
telemetry Metrics and tracing

Testing

cargo test

License

Licensed under the MIT License.

Credits

Rust port of Strands Agents SDK by AWS.

Commit count: 0

cargo fmt