Agents & Dragons: A Multi-Agent Architecture for AI Role-Playing Narratives

Agent-based artificial intelligence is enabling systems capable of coordinating complex tasks through collaboration between specialized components. One domain where this approach becomes particularly interesting is interactive narrative generation.

In this context, we developed Agents & Dragons, a role-playing storytelling system powered by AI agents designed to simulate the role of a Dungeon Master in traditional tabletop role-playing games.

The goal of the project is not only to create a dynamic, coherent, and challenging gaming experience. The architecture also serves as a practical example of multi-agent systems applied to complex AI workflows.

The challenge: simulating a Dungeon Master with AI

In tabletop role-playing games, the Dungeon Master (DM) acts as narrator and coordinator of the game.

Their responsibilities include:

  • creating and evolving the story
  • controlling non-player characters (NPCs)
  • interpreting the game world
  • applying the rules of the system
  • reacting to player decisions

Simulating all these behaviors with AI is a significant challenge.

A seemingly simple solution would be to instruct a language model to act as a Dungeon Master and generate the story dynamically while interacting with the player.

However, this approach introduces several problems.

Limitations of a single AI agent

Although a single agent could theoretically manage the entire narrative, several issues quickly emerge.

Responsibility overload

The Dungeon Master must perform many tasks simultaneously:

  • narrating the story
  • interpreting characters
  • applying game rules
  • maintaining world state
  • responding to player actions

Concentrating all these responsibilities in a single agent often leads to context limitations and logical inconsistencies.

This is a common issue in AI systems and one reason why modern architectures increasingly rely on multi-agent designs.

Lack of narrative consistency and challenge

Another issue is consistency.

When the model improvises the story without a structured system:

  • narrative inconsistencies may appear
  • rules are not properly enforced
  • the system accepts any action from the player

For example, if the player says “I start flying”, the AI may simply accept it without checking whether the rules allow such an action.

This removes the challenge from the game.

The solution: a multi-agent architecture

To address these issues, we designed a multi-agent architecture using Microsoft Agent Framework.

Each agent in the system has a clearly defined responsibility.

This design allows the system to:

  • separate responsibilities
  • maintain narrative coherence
  • enforce game rules
  • scale more effectively.

System architecture

The system consists of four main components:

  • frontend
  • backend
  • data structures
  • AI agents.

Frontend

The frontend is a simple web application built with:

  • Vue.js
  • Tailwind CSS

It includes:

  • an adventure selection menu
  • a chat interface where the game takes place.

Backend

The backend is implemented using FastAPI.

It exposes a REST API that manages communication between the frontend and the agent system.

Data structures

The system maintains data structures that store the current state of the game.

These structures are dynamically updated through tools invoked by the narrator agent.

Scene

Stores the current game state:

  • location
  • characters present
  • recent events
  • narrative context.

Sheet

Stores character statistics:

  • abilities
  • attributes
  • status.

AI agents

The core of the system consists of several specialized agents.

Orchestrator / Narrator

This agent acts as the primary Dungeon Master.

Its responsibilities include:

  • coordinating the other agents
  • maintaining narrative coherence
  • managing game state.

Rules agent

This agent applies the game’s rule system.

It receives:

  • an action
  • the scene state
  • character statistics.

It then evaluates the action according to the rules and returns the result.

NPC agent

This agent interprets non-player characters.

It receives:

  • the scene context
  • the NPC personality

and generates dialogue or actions accordingly.

Image generation agent

This agent enhances visual immersion.

It:

  1. analyzes the scene context
  2. generates prompts for an image generator
  3. maintains visual consistency using the previous image.

Technical considerations

Several technical decisions support the architecture.

Microsoft Agent Framework

All agents and tools are implemented using Microsoft Agent Framework.

Agents as tools

The Rules and NPC agents act as tools for the Narrator agent, allowing them to be invoked dynamically during gameplay.

Data validation with Pydantic

All inputs and outputs use models from Pydantic, ensuring structured communication between agents.

Memory management

Not all agents require memory.

For example:

  • the Narrator agent retains previous interactions
  • the Rules agent receives all necessary context through input parameters.

Conclusion

Agents & Dragons demonstrates how multi-agent architectures can address complex challenges in interactive storytelling.

Beyond gaming, the principles behind this system can be applied to many other domains where artificial intelligence must manage complex workflows and coordinate multiple specialized agents.

As multi-agent AI architectures evolve, this approach may become a foundational pattern for building advanced AI applications.

Multi-agent systems are opening new possibilities for building complex and autonomous AI solutions.

At Bravent, we design agent-based architectures using technologies such as Microsoft Agent Framework, applying them both in innovation projects and real business use cases.

If you are exploring how AI agents could enhance your applications or business processes, we would be happy to discuss your scenario.

📩 Contact us at info@bravent.net

Alejandro Fuster Bagetto

Alejandro Fuster Bagetto

Senior AI developer - Bravent
Jorge Verdeguer Gómez

Jorge Verdeguer Gómez

Machine Learning Engineer - Bravent
    Privacy

    This website uses cookies so that we can offer you the best possible user experience. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website or helping our team understand which sections of the website you find most interesting and useful.

    Strictly Necessary Cookies

    Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

    Third party cookies

    This website uses analytical cookies to collect anonymous information such as the number of visitors to the site, or the most popular pages.

    Leaving this cookie active allows us to improve our website.