# Strands harness and Harness SDK now support Rust, with a 50 ms Lambda cold start

> Source: <https://strandsagents.com/blog/strands-agents-rust-harness-sdk/>
> Published: 2026-12-01 21:47:33+00:00

**Key takeaway:** The Rust Strands Harness starts in 50 ms and peaks at 48 MB on AWS Lambda, versus 635 ms/195 MB for TypeScript and 2,428 ms/192 MB for Python, making scale-to-zero practical for interactive agent requests.

Today we’re releasing the Strands Harness and the Strands Harness SDK in Rust as a v0.1.0 developer preview: the [`strands-harness`](https://crates.io/crates/strands-harness) and [` strands`](https://crates.io/crates/strands) crates.

The [Strands Harness](https://strandsagents.com/docs/user-guide/harness/) is a fully assembled agent you can start with a few lines of code, and the [Strands Harness SDK](https://strandsagents.com/docs/user-guide/sdk/) is the agent loop, tools and model providers underneath it. When we [ran 94,000 benchmark trials](https://strandsagents.com/blog/we-ran-94000-trials-to-measure-the-cost-of-harness-choice/), Strands Harness had the highest accuracy and the lowest estimated cost in both the Anthropic and OpenAI comparisons, with estimated costs 34% lower at the median.

The Rust version is the same agent you get in Python and TypeScript, with the same system prompt, built-in tools and context management, behind an idiomatic Rust API.

We built both with [Strands Factory](https://strandsagents.com/blog/introducing-strands-factory/), the software factory we’re open sourcing this week. More on that below.

## Why Rust

Agents are showing up in places where startup time, memory and concurrency really matter. Think serverless functions that scale to zero, services holding thousands of concurrent sessions, and edge devices and robots with tight memory budgets. Rust compiles to a native binary with no runtime to boot, manages memory without a garbage collector, and runs async work across every core with [Tokio](https://tokio.rs).

To see what that means for an agent, we ran the same Strands Harness agent in all three languages on AWS Lambda (arm64, 1,024 MB, Amazon Nova on Amazon Bedrock) and took the median of 100 runs:

|  | Rust | TypeScript | Python | 
|---|---|---|---|
| Cold start | 50 ms | 635 ms | 2,428 ms | 
| Peak memory | 48 MB | 195 MB | 192 MB | 

Rust stands out in how quickly an agent starts and how little memory it needs while it runs. A 50 ms cold start makes scale-to-zero practical even for interactive requests, and at 48 MB you can fit many more agents into the same memory.

Rust’s async model can take this much further. [Infinity](https://aws.amazon.com/blogs/opensource/introducing-infinity-a-runtime-for-extreme-agent-concurrency/), a research runtime from the Hydro project, a collaboration between AWS and UC Berkeley, treats an agent the way Rust treats an async function. While the agent waits on a tool, the runtime saves its conversation and suspends it, so an idle agent costs about as much memory as its history. That fits 75,000 concurrent agents in the 8 GB of a Raspberry Pi 5, and a serverless function can exit while a tool call runs for hours. We’re experimenting with integrating Infinity into the Strands Harness and Harness SDK in Rust, and we’ll share more on that soon.

### A language agents write well

The second reason is that Rust is a great language for agents to write. The compiler checks types, ownership and thread safety before anything runs, and its error messages explain what went wrong and usually how to fix it. Here’s a classic concurrency mistake, moving a map into a background thread and then reading it:

It doesn’t build. The compiler says why, and suggests a fix:

A coding agent reads that, makes the change, and builds again. Whole classes of bugs get caught in seconds, with instructions attached. Once the code builds, the tests run, and any failures go back to the agent as more context for the next attempt. That tight loop is a big part of how Strands Factory could build this SDK, and you get the same benefit whenever your own agents write Rust.

### Compiled, and still dynamic

A fair question is whether a compiled language is too rigid for agents, which change what they do from one step to the next. It isn’t, because the two things happen at different levels. Your application and its tools are compiled. What the agent does with them is decided by the model at runtime, exactly as it is in Python and TypeScript.

The agent can also write and run code of its own. The Strands Harness in Rust includes [programmatic tool calling](https://strandsagents.com/docs/user-guide/harness/tools/programmatic-tool-calling/): the agent writes a Python script that chains, loops over and parallelizes its other tools, and the script runs in [Monty](https://github.com/pydantic/monty), a Python interpreter written in Rust by Pydantic. Monty keeps the agent’s code isolated from your application. It has no access to the filesystem, network or environment, so the script can only reach the tools the harness hands it. You get a native binary, and the agent can still write and run code.

## Your first Rust agent

Add the crates and Tokio:

Then create a harness and give it a task:

Run it with `cargo run` and the reply streams to your terminal.

### What a run looks like

The Strands Harness’s `create_harness` function returns a `strands::Agent`, the agent type from the Strands Harness SDK, with everything set up. Here’s a run of the example above, with the agent’s text and tool calls as they streamed to the terminal:

The agent opened with a web search and, in the same step, a shell command to look around the working directory. Then it needed five pricing and limits pages. It didn’t fetch them one at a time. It wrote this script:

That’s programmatic tool calling. `web_fetch` is the harness’s own tool, handed to the script as an async function, and the script runs [in Monty](https://strandsagents.com/docs/user-guide/harness/tools/programmatic-tool-calling/#isolated-code-execution), isolated from the rest of the program. Five pages come back from a single tool call, and only what the script prints enters the context window. The agent wrote two more scripts like it as its questions got narrower.

Pricing pages are long, and everything in the context window is sent to the model again on every call, where it costs tokens and crowds out the task at hand. That’s why the harness includes [context management](https://strandsagents.com/docs/user-guide/harness/configure/context-and-caching/#context-management). Two of the results were large, so it kept a short preview of each in the context window and archived the full text, and the agent used `retrieve_context` to read back only the parts it needed. Then it wrote `comparison.md`.

The run took just under two minutes: 11 model calls and 11 tool calls. Each of those model calls resent the same system prompt, tool definitions and growing conversation. The Strands Harness turns on [prompt caching](https://strandsagents.com/docs/user-guide/harness/configure/context-and-caching/#prompt-caching) by default and sets it up in the way each model provider handles best, so that repeated prefix is read from the cache and not processed again. In this run, 80% of the tokens the model processed came from the cache.

When the run ended, the [session](https://strandsagents.com/docs/user-guide/harness/configure/sessions/) was on disk under `.agent/sessions`, ready to resume by id. The agent had also saved six notes to [long-term memory](https://strandsagents.com/docs/user-guide/harness/configure/memory/) under `.agent/memory`, including which price it couldn’t find, and the next conversation can recall them.

Every default can be overridden, and you can build directly on the Strands Harness SDK when you want full control.

## Tools are async functions

The comparison above uses public prices. To make it about your workload, the agent needs something only you know, and that’s what [custom tools](https://strandsagents.com/docs/user-guide/sdk/tools/custom-tools/) are for. Write an async function and add `#[tool]`. The macro builds the schema the model sees from the parameters and doc comments:

MCP tools work too. List your MCP servers in the [`mcp_servers` option](https://strandsagents.com/docs/user-guide/harness/configure/mcp-servers/), and the harness connects to them and gives the agent their tools.

## Watch the agent work

`invoke` waits for the final answer. `stream` hands you each event as it happens: text as the model writes it, every tool call, and the final result. That’s what you need for a UI or an audit log, and it prints a log like the one above. This example also needs `cargo add futures`:

## Structured output

A Markdown file is fine for a person. When your code needs the comparison as data, ask for a type. Derive `Deserialize` and `JsonSchema` on a struct and the agent fills it in. The SDK validates the answer against the schema and asks the model to fix anything that doesn’t match. This example also needs `cargo add schemars` and `cargo add serde --features derive`:

The agent’s answer comes back as a `Comparison` value:

## What’s in the developer preview

Version 0.1.0 includes the entire Strands Harness and all of its features: the tuned system prompt, shell, file, web fetch and web search tools, programmatic tool calling, subagents, skills, a to-do list, context management, prompt caching, sessions, long-term memory, tool approval from a human, a model or Cedar policies, OpenTelemetry tracing and portable configuration.

The Strands Harness SDK underneath includes:

- **Models:** Amazon Bedrock, Bedrock Mantle, Anthropic, OpenAI and your own models, with routing between them using fallback and classifier strategies.
- **Agent loop:** streaming, structured output, cancellation, interrupts, hooks, plugins and middleware.
- **Tools:** custom tools, MCP tools over stdio, streamable HTTP and SSE, and more built-in tools, including bash, HTTP requests, notebooks and a Python REPL.
- **Multiple agents:** subagents, and agents as tools, where one agent calls another as a tool.
- **State:** sessions, conversation managers, long-term memory, pluggable storage and a pluggable sandbox.

As a developer preview, the API will keep improving based on your feedback. We follow semver: while the version starts with 0, breaking changes come in minor releases (0.2.0, 0.3.0) and patch releases never break your code.

## How we built it

A senior engineer on the Strands team and I spent several days designing the Rust version with the Strands Factory agent, running on Claude Opus 5.5 and Claude Fable 5.2. The result was a spec of nearly 20,000 words, with 77 binding design decisions, the architecture and a 14-phase plan. From there we used spec-driven development: the factory built the first version from the spec on its own, and the spec also told it how to work.

Every change went through formatting, strict lints, the full test suite with and without optional features, and doc builds. Each phase also checked the minimum supported Rust version, audited dependencies for advisories and licenses, and went to three independent reviewer agents.

No spec can cover every detail of a codebase this size. We covered as much ground as we could, and had the factory log every decision it made on its own and every place it changed something from the spec: 291 decisions in all. Engineers, scientists, solutions architects and developer advocates then reviewed every one of them, accepting or revising each, with the closest attention on anything that touches the public API. We revised 24 of them, about 8%, mostly API naming and design choices that shape how the Harness and SDK feel to use, and ran the factory again with the changes.

We validated the result in our own products, including Strands and an experimental software factory built by the [AWS Quick](https://aws.amazon.com/quick/) team. They built it on the Strands Harness in Rust and use it to build production features. What we found went back into the factory before release. We use Strands Factory to build Strands itself, which powers agents for many of our customers as well as many of AWS’s own AI agents, including AWS Quick and the [AWS frontier agents](https://aws.amazon.com/ai/frontier-agents/).

The [Strands Factory post](https://strandsagents.com/blog/introducing-strands-factory/) covers why this problem suited a software factory, how the build ran, and how to run the factory on your own repositories.

## Try it

Start with the [Harness quickstart](https://strandsagents.com/docs/user-guide/harness/quickstart/) or the [Rust Harness SDK quickstart](https://strandsagents.com/docs/user-guide/sdk/quickstart/rust/), and use the [Rust API reference](https://strandsagents.com/docs/api/rust/) as you go. The crates are on crates.io ([`strands-harness`](https://crates.io/crates/strands-harness), [` strands`](https://crates.io/crates/strands)), and the source lives in the `harness-rs` and `strands-rs` packages of the [harness-sdk repository](https://github.com/strands-agents/harness-sdk).

We’d love your feedback on the developer preview. [Open an issue](https://github.com/strands-agents/harness-sdk/issues) or come say hi on [Discord](https://discord.gg/strands). Now go build!
