The D&D Blueprint: How Role-Playing Engines Can Guide Next-Gen AI

At first glance, Dungeons & Dragons (D&D) isn’t the obvious launchpad for exploring artificial intelligence. First published in 1974, the tabletop RPG has inspired books, video games, and even a Hollywood blockbuster. But what fascinates engineers isn’t just cultural influence; it’s the rules engine beneath the storytelling.
At its core, D&D is a system of probabilities, rules, and imagination. Players create characters who embark on quests, while a Dungeon Master (DM) manages the world, monsters, and story. The DM’s job is brutal: juggling infinite player decisions, preparing for weeks, and improvising when things inevitably go sideways.
Combat makes things even tougher. The turn-based system runs on initiative order, where actions unfold sequentially based on dice rolls and stats. Even a single Fireball can spiral into chaos: resistances, counterspells, evasion rolls, and cascading damage. With more than a thousand abilities, the branching possibilities are staggering.
At Infobip Shift Zadar conference, Infobip engineers Rino Cala and Danijel Temraz set out to explore how these mechanics illuminate the challenges of building reliable agentic AI systems. To prove the point, they even built a working AI-powered game engine.

For developers, this problem resembles an infinite state machine. Coding it from scratch could take a team a year. Unsurprisingly, Rino and Danijel asked: Could large language models (LLMs) do it instead?
Turns out, not quite. Feeding turn-by-turn data into an LLM and expecting consistency doesn’t scale. Accuracy drops below 65% as context length grows, a problem we see in real-world AI. That led to the central question:
How do we design agentic AI systems that can handle complex, multi-step reasoning without collapsing under their own weight?

Rino Cala and Danijel Temraz presented their talk, “Playing D&D With AI: Building an Agentic Game Engine,” at this year’s Infobip Shift conference in Zadar.
How Infobip Built a Hybrid D&D Engine
The breakthrough came at an internal Infobip hackathon. The idea was: What if the Dungeon Master itself was an AI?
Over three days, the team prototyped a combat-focused engine powered by LLMs. Encouraged by the results, they extended the project into a two-month internship, bringing interns on board. The result was a working Agentic D&D Game Engine that could manage character creation and combat encounters.
Here’s how it works:
- Character Builder — Players choose a race, class, and background, and the system generates stats and a visual character representation.
- Combat Mechanics — Players roll dice against the monster’s armor classes. Successful rolls trigger damage; misses end turns.
- AI Dungeon Master — Once a player action lands, the LLM takes over, deciding monster behavior, ally responses, and narrating outcomes. The loop runs on “thought, action, observation,” with every decision validated in code before execution.
The design is hybrid by intent. Deterministic rules (dice rolls, turn order) live in code. The LLM handles intelligence and storytelling. That division prevents the AI from “hallucinating” or rewriting the game’s rules.
The payoff? A playable demo that kept true to D&D mechanics while showing how hybrid architectures make agentic AI more reliable. Visitors at Shift even fought one-monster battles against a “Shadow Duck” inside WhatsApp.
Why Agentic Systems Need a Dungeon Master’s Rules?
As fun as the project was, the team stressed that this wasn’t just about gaming. The D&D experiment revealed broader lessons for AI engineers.
They outlined two main paradigms in agentic systems:
- Workflows — Predefined, reliable, and predictable (think payment processing).
- Agents — Flexible, tool-using, goal-driven, but prone to error.
Workflows are safe but rigid, and agents are creative but risky. The sweet spot lies in hybrid systems: deterministic workflows paired with scoped agentic reasoning.
One recurring mistake in industry is overloading LLMs with giant prompts. That approach is brittle, since one tweak can break everything. Instead, modularity and context engineering are key. Each agent should be testable and scoped, with clear failure modes.
The Infobip team applied this directly: initiative order, for example, was coded deterministically instead of left to the AI. This prevented mistakes like monsters sneaking in extra turns.
These principles translate well to real-world applications. On Infobip’s platform, for instance, an AI-driven car dealership chatbot combined workflow logic with agentic reasoning, while handing off complex cases to human agents. That’s hybrid AI in action: predictable, scalable, and flexible.
The Agentic Future: Augmentation, Not Replacement
The broader takeaway is simple: agentic AI doesn’t replace deterministic systems, it augments them. By splitting responsibilities between code and AI, developers can create immersive and dependable systems.
Playing D&D with an AI Dungeon Master wasn’t just a nerdy hackathon stunt. It was a metaphor for the future of agentic systems. Complex, multi-turn interactions expose the limits of today’s LLMs, but also point the way forward.
Infobip’s Agentic D&D Game Engine shows that when deterministic code, structured workflows, and AI reasoning come together in a hybrid architecture, the result is more than a playable RPG.
Want to know what else was discussed at Infobip Shift at Zadar in 2025? Find out here!