This quickstart takes you to a running Rust agent with one custom tool. You install the SDK, invoke the default Amazon Bedrock model, and use `#[tool]` to expose an async function to the agent loop.

Developer preview

The Rust SDK is in developer preview. Before 1.0, breaking changes land in a `0.MINOR.0` release; `0.x.PATCH` releases remain compatible within their minor line.

**Using a coding agent?** Copy this prompt into Codex, Claude Code, Kiro, or any coding assistant and it will walk you through this page, ask a few setup questions, and offer to set up the Strands MCP server.

Copy prompt

## Create a project

Install Rust 1.96 or newer through [rustup](https://rustup.rs/), then create a binary project and add the SDK with the Tokio async runtime:

```bash
cargo new strands-quickstart
cd strands-quickstart
cargo add strands
cargo add tokio --features macros,rt-multi-thread
```

## Run your first agent

Create `src/main.rs` with an agent that uses Amazon Bedrock, the default model provider:

```rust
use strands::Agent;

#[tokio::main]
async fn main() -> strands::Result<()> {
    let mut agent = Agent::builder().build()?;

    agent.invoke("What is an agent harness, in one sentence?").await?;
    agent.shutdown().await
}
```

The default model is Claude Sonnet 4.6 on Amazon Bedrock. Give the SDK AWS credentials with permission to invoke the model, using one of:

-   **Bedrock API key**: set `AWS_BEARER_TOKEN_BEDROCK` to a [Bedrock API key](https://docs.aws.amazon.com/bedrock/latest/userguide/api-key-management.html).
-   **AWS credentials**: run `aws configure`, use an AWS profile, or set the AWS credential environment variables.
-   **IAM role**: run the agent on an AWS service with an attached role.

Set `AWS_REGION` to a region where the model is available. The SDK uses `us-west-2` when no region is configured.

Run the agent:

```bash
cargo run
```

The default printer streams the model response to the terminal. Each invocation also returns an [`AgentResult`](/docs/api/rust/reference/strands/agent/struct.AgentResult.html) with the final response, stop reason, and metrics. Call `shutdown()` before the process exits so the agent can finish cleanup.

## Add a custom tool

Replace `src/main.rs` with a typed tool and pass its generated tool struct to the agent:

```rust
use strands::{Agent, ToolError, tool};

#[tool(description = "Count occurrences of a specific letter in a word. \
                   Performs case-insensitive matching.")]
async fn letter_counter(
    /// Word to search.
    word: String,
    /// Letter to count.
    letter: char,
) -> Result<usize, ToolError> {
    Ok(word
        .chars()
        .filter(|candidate| candidate.eq_ignore_ascii_case(&letter))
        .count())
}

#[tokio::main]
async fn main() -> strands::Result<()> {
    let mut agent = Agent::builder().tools([LetterCounter]).build()?;
    agent
        .invoke(r#"How many letter R's are in the word "strawberry"?"#)
        .await?;
    agent.shutdown().await
}
```

Run the project again:

```bash
cargo run
```

The `#[tool]` macro generates the input schema from the typed parameters and the `LetterCounter` tool struct from the `letter_counter` function name.

## Choose another model provider

To run the agent on Anthropic, OpenAI, or the Amazon Bedrock Mantle endpoint, enable the provider’s Cargo feature:

```bash
cargo add strands --no-default-features --features anthropic
```

Without the default `bedrock` feature, pass an explicit model to [`Agent::builder()`](/docs/api/rust/reference/strands/agent/struct.Agent.html#method.builder). See the [Rust API reference](/docs/api/rust/index.md) for provider builders and feature flags.

## Next steps

-   [Browse the Rust API reference](/docs/api/rust/index.md)
-   [Compare SDK feature availability](/docs/user-guide/sdk/quickstart/overview/index.md#feature-availability)
-   [Use the preconfigured Strands harness](/docs/user-guide/harness/quickstart/index.md)

## Related pages

- [Choosing an Agent Foundation](/docs/user-guide/migrate/choosing-an-agent-foundation/index.md) (1 shared tag)
- [Get started](/docs/user-guide/sdk/quickstart/overview/index.md) (1 shared tag)
- [Optimization quickstart](/docs/user-guide/evals-sdk/optimization/quickstart/index.md) (1 shared tag)
- [Python Quickstart](/docs/user-guide/sdk/quickstart/python/index.md) (1 shared tag)
- [Strands evaluation quickstart](/docs/user-guide/evals-sdk/quickstart/index.md) (1 shared tag)
- [Strands Shell quickstart](/docs/user-guide/shell/quickstart/index.md) (1 shared tag)
- [TypeScript Quickstart](/docs/user-guide/sdk/quickstart/typescript/index.md) (1 shared tag)
- [Use Strands with AI coding agents](/docs/user-guide/build-with-ai/index.md) (1 shared tag)
- [Red teaming quickstart](/docs/user-guide/evals-sdk/red-teaming/quickstart/index.md) (1 shared tag)
- [Build a Voice Agent](/docs/user-guide/sdk/bidi/quickstart/index.md) (1 shared tag)


## Implementation

### Rust

- [harness-sdk/strands-rs/strands/src/agent/mod.rs](https://github.com/strands-agents/harness-sdk/blob/main/strands-rs/strands/src/agent/mod.rs)
