Automating Solo TTRPG Play; An AI-Powered Agentic Workflow

Marko Krišković avatar
Marko Krišković
Cover for Automating Solo TTRPG Play; An AI-Powered Agentic Workflow

Note: This workflow enables playing complex TTRPGs and board games. If you just want to play D&D, you probably don’t need something as intensive as AI models were already trained on lots of D&D roleplays

Automating Solo TTRPG Play: An AI-Powered Agentic Workflow

Playing tabletop role-playing games solo has always presented unique challenges. While single-player adventures exist, most TTRPGs and board games are designed for groups where multiple players control different characters with distinct knowledge, motivations, and abilities. The dream of solo play powered by AI seems within reach with today’s advanced language models—but there’s a critical problem.

The Challenge: Complexity Beyond Model Limits

Even state-of-the-art AI models struggle to simultaneously track complex game rules, maintain distinct character personalities, remember campaign background details, and avoid metagaming across multiple characters. A single monolithic prompt to an AI asking it to “play D&D” quickly becomes overwhelmed. The model might confuse spell slot mechanics, forget character motivations established sessions ago, or worse—have characters act on information only the player should know, breaking immersion through metagaming.

Traditional board games compound many challenges with rulebooks spanning hundreds of pages, edge cases requiring specific adjudication, and mechanical interactions that demand precise tracking.

The Solution: Agentic Modularization

The answer lies in agentic modularization—breaking down the game management task into specialized, autonomous AI agents that handle specific responsibilities. Rather than one overwhelmed model juggling everything, this ByteChef workflow creates a coordinated system where different agents focus on distinct aspects: character decision-making, rules interpretation, narrative generation, and memory management.

This modular approach enables parallelism and specialization. Each agent operates with goal-driven autonomy, perceiving its specific context, planning actions, and adapting based on feedback. Most importantly, it prevents metagaming by isolating character knowledge—each character’s decision agent only receives that character’s sheet, detailing their potential actions, personality, background and relationships, not information from other characters.

The Workflow Architecture: A D&D Example

Let’s walk through how this workflow handles a typical D&D combat scenario: “The goblins attack! Everyone roll initiative!”

Stage 1: Character Inclusion Detection

  • The workflow loads all character sheets from a structured data store.
  • For each character, an inclusion agent (e.g., using GPT-4) decides if they should act based on the prompt context (“all,” “everyone,” or specific names).
  • This agent processes each character independently.

Character Inclusion

Stage 2: Character Intent Generation

  • Each included character’s sheet (with personality/abilities as JSON) is fed into an intent agent.
  • The agent acts as the character’s brain, thinking through what they would do given their knowledge, abilities, and current situation.
  • AI Agents will have the memory of the whole Chat conversation and can also retrieve documents and store documents
  • We’ll retrieve the character’s previous past conversations (or memories), use Query Transformer to summarize them, and use Query Augmenter to modify the user query with context
  • It determines valid D&D actions (action, bonus action, reaction, movement) based on combat state.

Character Intent

For example: the cautious Wizard, Eldrin, would make sure he is at a safe distance using all of his movement, before attacking with the Magic Missile as his action. If anything threatens him, he will cast Shield as a reaction

Stage 3: Rules Adjudication Loop

  • After intent is proposed, an intent questions agent generates clarifying questions about mechanical rulings.
  • These feed to a Rules Lawyer agent backed by a vector-embedded rulebook for precise answers (e.g., “Does Shield stack with Mage Armor?”).
  • Each cycle, the agent reviews remaining questions and adjudicates using retrieval-augmented generation, looping until no more are left.

Rules Adjudication Loop

Knowledge Isolation

  • Mechanical clarifications and questions are stored per-character into DataStorage with the scope of this workflow. Meaning that it will persist in a ByteChefs database as long as you are chatting in this workflow. You can also put it in one of your databases that ByteChef supports.
  • When later processing the Rogue, that agent only sees the Rogue’s sheet; it can’t “peek” at the Wizard’s discoveries.

AI Agents

  • The Intent Questions AI Agent is simple. It simply asks questions based on the provided intent and previous questions, but only if it deems them necessary for taking the action.
  • Rules Lawyer AI Agent is a slightly more complex… It has to be able to handle massive amounts of data.
  • Using Document Joiner to join multiple documents, Query Transformer to summarize the context and response, and the latest model of Claude Sonnet to navigate the response
  • It will also put the response into Neo4j, so that I have logged the answers to the questions.

Rules Lawyer Ai Agent

Stage 4: Narrative Generation and Response

  • After all decisions and rules are resolved, a narrative AI Agent that uses Gemini describes the character’s action in a story-consistent way, considering and storing long-term memory
  • It uses the Random Helper tool, which it can use to roll any dice it needs. AI Agents are able to change the parameters of tools as needed.

Roleplay AI Agent

  • Since there are multiple characters in a Loop flow, multiple responses have to be appended into a single String and passed into the Chat

Response Storage

Chat with AI

  • In Playground mode you can Test your workflows. However, when you have the Chat trigger, it transforms into Chat mode where you can chat with AI Agents
  • The memory of the Chat is bound to that specific workflow. Unless you’re storing the conversation into a database, you can’t get the previous conversations

Chat


Conclusion

  • Each agent is specialized and has only the knowledge it should have—no crossing wires, no metagaming.
  • Knowledge context, clarifications, and memory are modular, producing play as rich and fair as with a human GM and more immersive than a single-AI approach.
  • Rules and personalities are respected, and dramatic surprise is preserved—allowing TTRPG and board game fans to deeply enjoy solo adventures or automate complex, multi-character games.