DEV Community

Haowen Huang
Haowen Huang

Posted on

Running Claude Agent SDK with Skills on Amazon Bedrock

by Haowen Huang (LinkedIn)

The Claude Agent SDK enables building multi-agent systems with Skills, MCP servers, and subagents. By default, it requires an Anthropic API key. This post shows how to run it entirely on Amazon Bedrock instead—no Anthropic API key needed.

The Problem

The DeepLearning.AI course "Agent Skills with Anthropic" assumes you have an ANTHROPIC_API_KEY. But what if you're already using AWS and want to leverage your existing Amazon Bedrock access?

The Solution: Two Lines of Code

The Claude Agent SDK uses Claude Code under the hood, which supports Amazon Bedrock via environment variables. The key configuration is surprisingly simple:

import os

# Configure Claude Code to use Amazon Bedrock
os.environ["CLAUDE_CODE_USE_BEDROCK"] = "1"
os.environ["AWS_REGION"] = "us-west-2"  # Your preferred region
Enter fullscreen mode Exit fullscreen mode

That's it. Set these before creating ClaudeSDKClient, and the SDK will use your AWS credentials instead of an Anthropic API key.

Prerequisites

Before running, verify your AWS setup:

# Check AWS CLI
aws --version

# Verify credentials
aws configure get aws_access_key_id

# Test Bedrock access
aws bedrock list-foundation-models --query "modelSummaries[?contains(modelId, 'claude')]" --output table
Enter fullscreen mode Exit fullscreen mode

You need:

  • AWS credentials configured (~/.aws/credentials or environment variables)
  • Amazon Bedrock model access enabled in your AWS console
  • IAM permissions for bedrock:InvokeModel

Complete Example

Here's the modified agent.py for Amazon Bedrock:

import asyncio
import os
from dotenv import load_dotenv
from claude_agent_sdk import (
    AgentDefinition, ClaudeSDKClient, ClaudeAgentOptions, AssistantMessage,
)

load_dotenv()
AWS_REGION = os.environ.get("AWS_REGION", "us-west-2")

# Key configuration for Bedrock
os.environ["CLAUDE_CODE_USE_BEDROCK"] = "1"
os.environ["AWS_REGION"] = AWS_REGION

async def main():
    agents = {
        "docs_researcher": AgentDefinition(
            description="Finds information from official documentation.",
            prompt="You research official docs.",
            tools=["WebSearch", "WebFetch"],
            model="haiku"
        ),
    }

    options = ClaudeAgentOptions(
        system_prompt="You are a helpful assistant.",
        allowed_tools=["Skill", "Task", "Write", "Bash", "WebSearch", "WebFetch"],
        model="sonnet",
        agents=agents
    )

    async with ClaudeSDKClient(options=options) as client:
        await client.query("Hello!")
        async for message in client.receive_response():
            if isinstance(message, AssistantMessage):
                print(message.content)

asyncio.run(main())
Enter fullscreen mode Exit fullscreen mode

Adding MCP Servers (Optional)

MCP servers like Notion work the same way. Just ensure the token exists before adding the config:

What Works on Amazon Bedrock

Everything from the original SDK works:

  • Skills (e.g., learning-a-tool)
  • Subagents with parallel execution
  • MCP servers (Notion, etc.)
  • All built-in tools (WebSearch, Bash, Write, etc.)

A Note on the Debugging Process

This entire migration—from identifying the Bedrock configuration, fixing MCP server issues, to successfully running Skills with subagents—was completed through conversation with Kiro, an AI-powered IDE. No external documentation was consulted. Kiro diagnosed issues in real-time, suggested fixes, and validated the setup by running test scripts directly.

The workflow:

  1. Asked Kiro how to use Bedrock instead of Anthropic API
  2. Kiro checked the environment, identified missing dependencies
  3. Kiro found the correct configuration (environment variables, not client parameters)
  4. Fixed runtime errors (MCP config validation when token was missing)
  5. Verified everything worked end-to-end

This demonstrates how AI-assisted development can accelerate debugging unfamiliar SDKs without documentation diving.

Conclusion

Running Claude Agent SDK on Amazon Bedrock requires just two environment variables. Your existing AWS credentials handle authentication, and all SDK features—Skills, subagents, MCP servers—work unchanged.

If you're already in the AWS ecosystem, this is the simplest path to using Claude Agent SDK without managing a separate Anthropic API key.

Top comments (0)