Strands Agents
Swift SDK
Build AI agents in Swift. Community implementation of the AWS Strands Agents framework, with feature parity with the Python and TypeScript SDKs plus native Apple Silicon support.
What is Strands Agents?
Strands Agents is an open-source SDK by AWS for building AI agents. An agent combines a model, tools, and a system prompt inside a reasoning loop. The loop receives user input, calls the model, executes any tools the model requests, and repeats until it produces a final answer.
This Swift SDK is at feature parity with the official Python and TypeScript SDKs, with additional support for on-device inference via MLX and native Apple audio I/O for voice agents.
Explore the Docs
Getting Started
Install the package and run your first agent in minutes.
Agents
Understand the agent loop, system prompts, and configuration.
Tools
Give agents capabilities with the @Tool macro.
Structured Output
Force the model to return typed Swift structs.
Streaming
Display tokens as they generate for real-time UI.
Multi-Agent
Coordinate multiple specialized agents with Graph, Swarm, or A2A.
Voice Agents
Real-time bidirectional voice with cloud or on-device models.
Local Inference
Run models on Apple Silicon with no network or API keys.
Observability
OpenTelemetry tracing, per-cycle metrics, and hooks.
Quick Example
import StrandsAgents
import StrandsBedrockProvider
/// Count the number of words in a block of text.
@Tool
func wordCount(text: String) -> Int {
text.split(whereSeparator: \.isWhitespace).count
}
let agent = Agent(
model: try BedrockProvider(config: BedrockConfig(
modelId: "us.anthropic.claude-sonnet-4-20250514-v1:0"
)),
tools: [wordCount]
)
let result = try await agent.run("How many words are in the Gettysburg Address?")
print(result.output)
Platform Support
| Feature | macOS 14+ | iOS 17+ | tvOS 17+ |
|---|---|---|---|
| Core agent + tools | ✓ | ✓ | ✓ |
| Cloud providers | ✓ | ✓ | ✓ |
| MLX local inference | Apple Silicon | N/A | N/A |
| Voice agents (cloud) | ✓ | ✓ | N/A |
| Voice agents (local) | Apple Silicon | N/A | N/A |