Building RealmKeeper: A Multi-Agent AI Dungeon Master on AWS
Learn how a fantasy Game Master was built from multiple specialized AI agents using the Strands Agents SDK, MCP and A2A, then taken to production on Amazon Bedrock AgentCore.
Why build a Dungeon Master?
A tabletop Game Master is a multi-agent system in miniature: one person narrates the world, checks the rulebook, tracks every character sheet and rolls the dice. That makes it a natural way to learn how specialized AI agents share work.
RealmKeeper is my take on that idea: a fantasy RPG Game Master built with the Strands Agents SDK and deployed to Amazon Bedrock AgentCore. My main takeaway is that the future of AI is not only smarter individual models. It is systems where specialized agents delegate tasks, share context and work together.
This article walks through the architecture, the building blocks I used, and what moving from a laptop prototype to a managed AWS runtime looked like.
The journey: from one agent to a deployed party
The project follows the AWS workshop Once Upon Agentic AI , which teaches the Strands Agents SDK by building a Game Master. Each chapter reuses the previous one, so the system grows in layers.
Chapter | What gets built |
|---|---|
1. Agent summoning | A first agent, a system prompt and debug logs |
2. Vended tools | SDK-provided tools such as http_request , used against the Open5e API |
3. Custom tools | A dice roller written with the @tool decorator |
4. MCP | The same dice roller served over the Model Context Protocol |
5. A2A | A Rules Agent and a Character Agent behind a Game Master orchestrator |
6. Web interface | A browser UI to play with the Game Master |
7. Strands harness (optional) | The Game Master API rebuilt with create_harness() |
8. Production | Every agent and server deployed to Amazon Bedrock AgentCore |
The agents run on Amazon Bedrock by default, using Claude Sonnet 4.6.
Why multiple agents instead of one
A single agent can run a simple game, but it ends up carrying every responsibility in one prompt: story, rules lookups, character state and dice. Splitting those jobs gives each agent a narrow prompt and its own tools.
RealmKeeper uses three roles:
- Game Master: the orchestrator. It talks to the player, decides what needs to happen next and delegates.
- Rules Agent: a specialist that answers rules questions.
- Character Agent: a specialist that handles the player's characters.
The specialists run as remote agents that the Game Master reaches over the Agent-to-Agent (A2A) protocol, which is what makes them independently deployable. The orchestrator also returns structured output, so the web interface can render the result predictably rather than parsing free text.
Giving agents hands: vended and custom tools
An agent that can only talk is a storyteller. Tools let it act. The Strands SDK ships ready-made tools, called vended tools, and the workshop uses
http_request to let an agent query the Open5e API for real game rules. A bonus exercise adds shell and file_editor tools gated by HumanInTheLoop , so a person approves risky actions before they run.Custom tools are plain Python functions with a decorator. The dice roller is the classic example. This simplified sketch shows the shape, not the workshop's exact code:
import randomfrom strands import tool
@tooldef roll_dice(sides: int = 20, count: int = 1) -> dict: """Roll dice and return the individual rolls and their total.""" rolls = [random.randint(1, sides) for _ in range(count)] return {"rolls": rolls, "total": sum(rolls)}
The docstring and type hints become the tool's description and schema, so the model knows when and how to call it. Dice are a good first tool because randomness is exactly what a language model should not improvise.
MCP: one tool, many agents
The Model Context Protocol (MCP) moves a tool out of the agent's own code and behind a standard interface. In the workshop, the same dice roller is served over MCP and an agent consumes it as a client.
That separation matters for three reasons:
- The tool can be reused by any MCP-capable agent without copying code.
- It can be deployed, versioned and secured on its own.
- Swapping or upgrading the tool does not mean touching the agent.
The workshop pins
mcp<2 because MCP 2.0 renamed the FastMCP server class that this chapter teaches, a reminder to pin SDK versions when you build on fast-moving protocols.A2A: agents that talk to agents
MCP connects an agent to tools. Agent-to-Agent (A2A) connects an agent to other agents. Chapter 5, "The Grand Alliance," builds the Rules Agent and the Character Agent as A2A servers and a Game Master that orchestrates them.
Two details make this practical:
- Agent cards. Each A2A server publishes a card over HTTP describing who it is and what it can do, so the orchestrator can discover specialists instead of hard-coding them.
- Per-context isolation. An
agent_factorycreates a fresh agent for each conversation context, so one player's session never leaks into another's. The workshop's tests check this isolation and the agent card.
The Game Master then combines what the specialists return into a structured response, which is what the web interface in chapter 6 renders.
Going to production with Amazon Bedrock AgentCore
Running agents on a laptop proves the idea. Chapter 8 deploys the whole party to Amazon Bedrock AgentCore with the
agentcore CLI: the dice server, the Character Agent, the Rules Agent and the Game Master each run on AgentCore Runtime.
The chapter starts again from the chapter 5 code and moves each concern to a managed home:
Concern | Where it lives on AgentCore |
|---|---|
Hosting | AgentCore Runtime, for the dice server and all three agents |
Service-to-service calls | IAM-signed MCP and A2A calls |
Characters and conversation | AgentCore Memory |
Game rules | A managed knowledge base |
IAM-signed calls mean agents authenticate to each other with AWS credentials rather than shared secrets. AgentCore Memory keeps character and conversation context across sessions. The knowledge base gives the Rules Agent a managed place to retrieve rules from.
To follow along in your own AWS account you need credentials with Amazon Bedrock model access, Node.js 20+ and the AgentCore CLI . In the workshop's Code Editor everything is already set up.
Key takeaways
- Specialize, then orchestrate. Narrow agents with focused prompts and tools are easier to reason about than one agent doing everything.
- Standards keep systems loosely coupled. MCP for tools and A2A for agents let each piece be built, deployed and replaced on its own.
- Let tools handle what models shouldn't improvise. Dice, lookups and state belong in code and managed services, not in generated text.
- Production is a different chapter, not a footnote. Identity, memory and knowledge need managed homes, which is what AgentCore provides.
- Pin your dependencies. Agent SDKs and protocols are moving fast, and a single major release can rename the class a tutorial depends on.
The broader point stands: the interesting work in agentic AI is shifting from "how smart is the model?" to "how well do the agents communicate, delegate and share context?"
Try it yourself
- Workshop instructions: Once Upon Agentic AI
- Code: SenalDilanka/realmkeeper , with
# TODOmarkers in each chapter folder andsolution-*branches if you get stuck
- SDK: Strands Agents
- Setup: Python 3.10+ and
uv, thenuv sync
When you finish, follow the workshop's cleanup chapter to remove the chapter 8 AWS resources so nothing keeps running and billing.
What would you add to your own party of agents: a loot-and-inventory agent, a world-building agent, or something stranger?
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article