Skip to content

Commit f5a38ac

Browse files
committed
AWS Bedrock provider support
- AWS Bedrock provider, supporting multiple model families (Anthropic Claude, Amazon Titan, Meta Llama, and Mistral). Signed-off-by: Alvaro Saurin <[email protected]>
1 parent ac768e6 commit f5a38ac

File tree

8 files changed

+1044
-3
lines changed

8 files changed

+1044
-3
lines changed

docs/USAGE.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ agents with specialized capabilities and tools. It features:
1515
- **📦 Agent distribution** via Docker registry integration
1616
- **🔒 Security-first design** with proper client scoping and resource isolation
1717
- **⚡ Event-driven streaming** for real-time interactions
18-
- **🧠 Multi-model support** (OpenAI, Anthropic, Gemini, [Docker Model Runner (DMR)](https://docs.docker.com/ai/model-runner/))
18+
- **🧠 Multi-model support** (OpenAI, Anthropic, Gemini, Amazon Bedrock, [Docker Model Runner (DMR)](https://docs.docker.com/ai/model-runner/))
1919

2020

2121
## Why?
@@ -141,7 +141,7 @@ cagent run ./agent.yaml --command ls
141141

142142
| Property | Type | Description | Required |
143143
|---------------------|------------|------------------------------------------------------------------------------|----------|
144-
| `provider` | string | Provider: `openai`, `anthropic`, `google`, `dmr` | ✓ |
144+
| `provider` | string | Provider: `openai`, `anthropic`, `google`, `amazon-bedrock`, `dmr` | ✓ |
145145
| `model` | string | Model name (e.g., `gpt-4o`, `claude-sonnet-4-0`, `gemini-2.5-flash`) | ✓ |
146146
| `temperature` | float | Randomness (0.0-1.0) | ✗ |
147147
| `max_tokens` | integer | Response length limit | ✗ |
@@ -156,7 +156,7 @@ cagent run ./agent.yaml --command ls
156156
```yaml
157157
models:
158158
model_name:
159-
provider: string # Provider: openai, anthropic, google, dmr
159+
provider: string # Provider: openai, anthropic, google, amazon-bedrock, dmr
160160
model: string # Model name: gpt-4o, claude-3-5-sonnet-latest, gemini-2.5-flash, qwen3:4B, ...
161161
temperature: float # Randomness (0.0-1.0)
162162
max_tokens: integer # Response length limit
@@ -282,6 +282,12 @@ models:
282282
provider: google
283283
model: gemini-2.5-flash
284284
285+
# Amazon Bedrock
286+
models:
287+
bedrock-claude:
288+
provider: amazon-bedrock
289+
model: anthropic.claude-3-5-sonnet-20241022-v2:0
290+
285291
# Docker Model Runner (DMR)
286292
models:
287293
qwen:
@@ -386,6 +392,57 @@ Troubleshooting:
386392
- Endpoint empty in status: ensure the Model Runner is running, or set `base_url` manually
387393
- Flag parsing: if using a single string, quote properly in YAML; you can also use a list
388394

395+
#### Amazon Bedrock provider usage
396+
397+
The `amazon-bedrock` provider enables access to various AI models hosted on AWS Bedrock, including Anthropic Claude, Amazon Titan, Meta Llama, and Mistral models.
398+
399+
**Authentication:**
400+
401+
The Bedrock provider supports two authentication methods:
402+
403+
1. **Bearer Token** (via `AWS_BEDROCK_TOKEN` environment variable):
404+
- Use for custom authentication services or proxy scenarios
405+
- If set, the provider uses Bearer token authentication and skips AWS Signature v4 signing
406+
- Example: `export AWS_BEDROCK_TOKEN="your-token-here"`
407+
408+
2. **Standard AWS Credentials** (default chain):
409+
- Environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`
410+
- AWS profile: `AWS_PROFILE` environment variable or default profile in `~/.aws/credentials`
411+
- IAM role (for EC2/ECS/Lambda environments)
412+
413+
**Configuration:**
414+
415+
Basic configuration:
416+
417+
```yaml
418+
models:
419+
bedrock-claude:
420+
provider: amazon-bedrock
421+
model: anthropic.claude-3-5-sonnet-20241022-v2:0
422+
temperature: 0.7
423+
max_tokens: 4000
424+
```
425+
426+
With custom region:
427+
428+
```yaml
429+
models:
430+
bedrock-claude:
431+
provider: amazon-bedrock
432+
model: anthropic.claude-3-5-sonnet-20241022-v2:0
433+
provider_opts:
434+
region: us-west-2 # Optional, defaults to AWS_REGION or us-east-1
435+
```
436+
437+
With custom endpoint (for VPC endpoints or proxies):
438+
439+
```yaml
440+
models:
441+
bedrock-claude:
442+
provider: amazon-bedrock
443+
model: anthropic.claude-3-5-sonnet-20241022-v2:0
444+
base_url: https://bedrock-runtime.us-east-1.amazonaws.com
445+
```
389446

390447
### Alloy models
391448

examples/bedrock.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: "2"
2+
3+
agents:
4+
root:
5+
model: claude
6+
description: "Test multi-tool agent"
7+
instruction: |
8+
You are a test agent that demonstrates multi-tool calling.
9+
10+
⚠️ CRITICAL INSTRUCTIONS - YOU MUST FOLLOW THESE EXACTLY:
11+
12+
When the user asks you to call multiple tools:
13+
1. Call the FIRST tool and wait for its result
14+
2. After receiving the first result, you MUST call the SECOND tool
15+
3. After receiving the second result, ONLY THEN respond to the user
16+
17+
DO NOT respond with text after calling just one tool.
18+
DO NOT say "I'll call the tools" - JUST CALL THEM.
19+
DO NOT provide your final answer until you have called ALL required tools.
20+
21+
If the task requires N tools, you must make N separate tool calls.
22+
Each tool call must be followed by receiving its result before the next tool call.
23+
24+
Example correct sequence:
25+
- Tool Call 1 → Receive Result 1
26+
- Tool Call 2 → Receive Result 2
27+
- Final Response with both results
28+
29+
WRONG (do not do this):
30+
- Tool Call 1 → Receive Result 1 → Final Response (MISSING TOOL 2!)
31+
32+
max_iterations: 20
33+
toolsets:
34+
- type: shell
35+
36+
models:
37+
claude:
38+
provider: amazon-bedrock
39+
model: us.anthropic.claude-sonnet-4-5-20250929-v1:0
40+
temperature: 0.7
41+
max_tokens: 4000
42+
# Optional: specify AWS region (defaults to AWS_REGION env var or us-east-1)
43+
# provider_opts:
44+
# region: us-west-2

go.mod

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ require (
99
github.com/alecthomas/chroma/v2 v2.20.0
1010
github.com/anthropics/anthropic-sdk-go v1.14.0
1111
github.com/atotto/clipboard v0.1.4
12+
github.com/aws/aws-sdk-go-v2 v1.39.3
13+
github.com/aws/aws-sdk-go-v2/config v1.31.13
14+
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.41.1
15+
github.com/aws/smithy-go v1.23.1
1216
github.com/aymanbagabas/go-udiff v0.3.1
1317
github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250820203609-601216f68ee2
1418
github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.4.0.20250930175933-4cafc092c5e7
@@ -44,6 +48,17 @@ require (
4448
cloud.google.com/go/auth v0.16.5 // indirect
4549
cloud.google.com/go/compute/metadata v0.8.0 // indirect
4650
github.com/JohannesKaufmann/dom v0.2.0 // indirect
51+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.2 // indirect
52+
github.com/aws/aws-sdk-go-v2/credentials v1.18.17 // indirect
53+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.10 // indirect
54+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10 // indirect
55+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10 // indirect
56+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
57+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2 // indirect
58+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.10 // indirect
59+
github.com/aws/aws-sdk-go-v2/service/sso v1.29.7 // indirect
60+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.2 // indirect
61+
github.com/aws/aws-sdk-go-v2/service/sts v1.38.7 // indirect
4762
github.com/aymerick/douceur v0.2.0 // indirect
4863
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
4964
github.com/charmbracelet/colorprofile v0.3.2 // indirect

go.sum

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,36 @@ github.com/anthropics/anthropic-sdk-go v1.14.0 h1:EzNQvnZlaDHe2UPkoUySDz3ixRgNbw
2626
github.com/anthropics/anthropic-sdk-go v1.14.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
2727
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
2828
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
29+
github.com/aws/aws-sdk-go-v2 v1.39.3 h1:h7xSsanJ4EQJXG5iuW4UqgP7qBopLpj84mpkNx3wPjM=
30+
github.com/aws/aws-sdk-go-v2 v1.39.3/go.mod h1:yWSxrnioGUZ4WVv9TgMrNUeLV3PFESn/v+6T/Su8gnM=
31+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.2 h1:t9yYsydLYNBk9cJ73rgPhPWqOh/52fcWDQB5b1JsKSY=
32+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.2/go.mod h1:IusfVNTmiSN3t4rhxWFaBAqn+mcNdwKtPcV16eYdgko=
33+
github.com/aws/aws-sdk-go-v2/config v1.31.13 h1:wcqQB3B0PgRPUF5ZE/QL1JVOyB0mbPevHFoAMpemR9k=
34+
github.com/aws/aws-sdk-go-v2/config v1.31.13/go.mod h1:ySB5D5ybwqGbT6c3GszZ+u+3KvrlYCUQNo62+hkKOFk=
35+
github.com/aws/aws-sdk-go-v2/credentials v1.18.17 h1:skpEwzN/+H8cdrrtT8y+rvWJGiWWv0DeNAe+4VTf+Vs=
36+
github.com/aws/aws-sdk-go-v2/credentials v1.18.17/go.mod h1:Ed+nXsaYa5uBINovJhcAWkALvXw2ZLk36opcuiSZfJM=
37+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.10 h1:UuGVOX48oP4vgQ36oiKmW9RuSeT8jlgQgBFQD+HUiHY=
38+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.10/go.mod h1:vM/Ini41PzvudT4YkQyE/+WiQJiQ6jzeDyU8pQKwCac=
39+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10 h1:mj/bdWleWEh81DtpdHKkw41IrS+r3uw1J/VQtbwYYp8=
40+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10/go.mod h1:7+oEMxAZWP8gZCyjcm9VicI0M61Sx4DJtcGfKYv2yKQ=
41+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10 h1:wh+/mn57yhUrFtLIxyFPh2RgxgQz/u+Yrf7hiHGHqKY=
42+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10/go.mod h1:7zirD+ryp5gitJJ2m1BBux56ai8RIRDykXZrJSp540w=
43+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
44+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
45+
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.41.1 h1:sscdABXtedWQ+5I0YnxawJwrX1YzbPhIs7TklRaRDpk=
46+
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.41.1/go.mod h1:LVJ9jAJ1nuUyhovH5z7GAA/FktQOMarcZgGeqiHQJPo=
47+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2 h1:xtuxji5CS0JknaXoACOunXOYOQzgfTvGAc9s2QdCJA4=
48+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2/go.mod h1:zxwi0DIR0rcRcgdbl7E2MSOvxDyyXGBlScvBkARFaLQ=
49+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.10 h1:DRND0dkCKtJzCj4Xl4OpVbXZgfttY5q712H9Zj7qc/0=
50+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.10/go.mod h1:tGGNmJKOTernmR2+VJ0fCzQRurcPZj9ut60Zu5Fi6us=
51+
github.com/aws/aws-sdk-go-v2/service/sso v1.29.7 h1:fspVFg6qMx0svs40YgRmE7LZXh9VRZvTT35PfdQR6FM=
52+
github.com/aws/aws-sdk-go-v2/service/sso v1.29.7/go.mod h1:BQTKL3uMECaLaUV3Zc2L4Qybv8C6BIXjuu1dOPyxTQs=
53+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.2 h1:scVnW+NLXasGOhy7HhkdT9AGb6kjgW7fJ5xYkUaqHs0=
54+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.2/go.mod h1:FRNCY3zTEWZXBKm2h5UBUPvCVDOecTad9KhynDyGBc0=
55+
github.com/aws/aws-sdk-go-v2/service/sts v1.38.7 h1:VEO5dqFkMsl8QZ2yHsFDJAIZLAkEbaYDB+xdKi0Feic=
56+
github.com/aws/aws-sdk-go-v2/service/sts v1.38.7/go.mod h1:L1xxV3zAdB+qVrVW/pBIrIAnHFWHo6FBbFe4xOGsG/o=
57+
github.com/aws/smithy-go v1.23.1 h1:sLvcH6dfAFwGkHLZ7dGiYF7aK6mg4CgKA/iDKjLDt9M=
58+
github.com/aws/smithy-go v1.23.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
2959
github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY=
3060
github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E=
3161
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=

0 commit comments

Comments
 (0)