TC

temporal-community/bedrock-agents-mcp-workshop

Developer tools
21 stars 0 forks 품질 60 트렌드 60

Hands-on Workshop on Building AI Agents with Strands, MCP, and Temporal

개요

Build AI agents using the AWS Bedrock Converse API directly — no frameworks, just boto3. Go from a simple agent to a crash-proof Temporal workflow in three modules. Each module builds on the last. By the end, you'll understand how LLMs call tools, how MCP decouples tools from agents, and how Temporal makes it all production-ready. — agent with one tool, running in a chat loop: — same loop, but tools discovered from an MCP server: — same loop, now crash-proof with Temporal (every step visible in the UI): Every module has a that walks through the code and a set of you can read and run. No blank files, no busywork — just read the code, understand it, run it. - - configured with Bedrock access (aws configure) - (Module 3 only) — install guide This checks all dependencies, AWS credentials, Bedrock model access, and Temporal CLI. Fix anything marked [FAIL] before continuing — see Troubleshooting.

README

Build AI Agents from Scratch — Bedrock, MCP & Temporal

Build AI agents using the AWS Bedrock Converse API directly — no frameworks, just boto3. Go from a simple agent to a crash-proof Temporal workflow in three modules.

What you’ll build

Module What you build Key concept
Module 1 Agent with custom tools + chat loop Bedrock converse() tool-use loop
Module 2 MCP server + agent with tool discovery Model Context Protocol
Module 3 Durable agent with Temporal workflows Crash recovery, replay, observability

Each module builds on the last. By the end, you’ll understand how LLMs call tools, how MCP decouples tools from agents, and how Temporal makes it all production-ready.

Module 1 — agent with one tool, running in a chat loop:

Module 2 — same loop, but tools discovered from an MCP server:

Module 3 — same loop, now crash-proof with Temporal (every step visible in the UI):

How this workshop works

Every module has a README that walks through the code and a set of working Python files you can read and run. No blank files, no busywork — just read the code, understand it, run it.

Prerequisites

  • Python 3.10+
  • AWS credentials configured with Bedrock access (aws configure)
  • Temporal CLI (Module 3 only) — install guide

Setup

pip install -e .

Verify your setup before starting Module 1:

python check_setup.py

This checks all dependencies, AWS credentials, Bedrock model access, and Temporal CLI. Fix anything marked [FAIL] before continuing — see Troubleshooting.

The one pattern

Every module follows the same tool-use loop:

                    ┌─────────────────────────┐
                    │  1. Send messages +      │
                    │     tool definitions     │
                    │     to bedrock.converse() │
                    └────────────┬─────────────┘
                                 │
                                 ▼
                    ┌─────────────────────────┐
                    │  2. Model responds       │
                    │     stopReason?          │
                    └─────┬───────────┬────────┘
                          │           │
                   "end_turn"    "tool_use"
                          │           │
                          ▼           ▼
                    ┌──────────┐ ┌──────────────────┐
                    │ Return   │ │ 3. Execute tool   │
                    │ text     │ │    locally         │
                    └──────────┘ └────────┬──────────┘
                                          │
                                          ▼
                                 ┌─────────────────────┐
                                 │ 4. Send toolResult  │
                                 │    back → loop      │
                                 └─────────────────────┘

What changes across modules is where the tools come from and where the loop runs:

Tools from Loop runs in Crash behavior
Module 1 Local Python functions Your process Lost
Module 2 MCP server + local Your process Lost
Module 3 Temporal activities Temporal workflow Survives crashes

Quick reference

# Module 1
cd module_1_basic_agent && python agent.py

# Module 2
cd module_2_mcp && python agent.py

# Module 3 (3 terminals)
temporal server start-dev                        # terminal 1
cd module_3_temporal && python worker.py          # terminal 2
cd module_3_temporal && python start.py           # terminal 3

Start with Module 1 →

Troubleshooting

NoCredentialError / Unable to locate credentials Run aws configure and set your Access Key, Secret Key, and region (us-east-1). Verify with aws sts get-caller-identity.

AccessDeniedException / You don't have access to the model Your AWS account needs Bedrock model access enabled. Go to the Bedrock console → Model access → Request access to Claude 3.5 Haiku (us.anthropic.claude-3-5-haiku-20241022-v1:0).

ThrottlingException / Rate exceeded You’re hitting Bedrock rate limits. Wait a few seconds and try again, or switch to a model with higher throughput limits.

ModuleNotFoundError: No module named 'boto3' (or mcp, temporalio) Run pip install -e . from the project root. This installs all dependencies from pyproject.toml.

Module 2: MCP server errors / Connection refused The MCP server is launched automatically by agent.py — you don’t start it separately. Make sure mcp_server.py is in the same directory as agent.py. If you see Python errors from the server, check that mcp is installed.

Module 3: Connection refused on port 7233 Temporal server isn’t running. Start it first: temporal server start-dev (Terminal 1).

Module 3: Worker starts but nothing happens The worker waits for work. You need to run python start.py in a separate terminal (Terminal 3) to send prompts to the workflow.

View this README on GitHub

설치

This server does not publish a one-line install command.

Open the repository installation guide