How Multi-Agent AI Systems in Mendix Can Train You for a Marathon
Running is great—it helps you sleep better, boosts your immune system, and gives you that unbeatable feeling of progress, especially when you’re training for something big like a marathon. Just like running, building with Mendix can be both empowering and rewarding. And if you’re skeptical about low code, don’t be—Mendix gives you the flexibility to integrate with other platforms and the control you need to build serious, scalable applications.
So, with marathon season in full swing, we thought: why not show off Mendix’s multi-agent AI systems capabilities by building a smart app to help you train? In this blog, we’ll walk through how to create a multi-agent system in Mendix that supports developer-runners in reaching their goals. Because whether it’s logic in microflows or kilometers on the road, the best way to finish… is to start.
Why use multi-agent AI systems?
AI agents are everywhere right now—you’ve probably seen them all over your feed. But before we dive into building agent-based systems in Mendix, let’s take a quick step back and break down what an AI agent actually is.
AI agents
At its core, an AI agent (also called an LLM agent) is a smart program that can take action on its own when something triggers it—like a user doing something in an app, or another system sending data. These agents can use tools, functions, or even knowledge bases to figure out what to do. Some agents are built to learn over time, while others are focused on getting specific tasks done. Either way, the goal is to make life easier—by automating work, speeding up processes, or just making things run more smoothly.
If you’re brand new to this, check out our guide on how to build a single agent in Mendix. It covers how to combine prompt engineering, function calling, and knowledge bases—all within a Mendix app.
Sometimes, one agent just isn’t enough to get the job done. Single-agent systems work well for simpler tasks, but as problems get more complex or less clearly defined—just like in real life—it often takes a team. That’s where multi-agent systems come in. By working together, different agents can specialize in certain tasks and coordinate their efforts to reach better, more effective outcomes.
Putting multi-agent AI into practice
Once you understand the basics of AI and how Mendix works, building a multi-agent system isn’t as complicated as it sounds. If you’re just getting started, we recommend checking out our guide on how to build a single agent first, along with some helpful resources on prompt engineering.
What’s especially cool about multi-agent systems is that agents can work together in different ways—depending on the problem you’re trying to solve. They can follow a fixed flow, delegate tasks, evaluate each other’s output, or even make decisions about who should handle what.
To see these patterns in action, take a look at the GenAI Showcase App, and explore several multi-agent setups, including:
- Deterministic Flow / Prompt Chaining
- Deterministic Flow / Prompt Chaining with Gatekeeper
- Evaluator-Optimizer Agent
- Routing-Based Agent Collaboration
Multi-agent routing pattern for the Mendix Running App
In this blog post, we’ll be referencing the GenAI Showcase App, especially the Routing example found in the Multi-Agent Patterns section. In this setup, the first agent acts as the routing agent. Its job isn’t to respond directly to the user—instead, it decides which of the available agents is best suited to handle the request. Once it makes that decision, it passes the entire conversation to the selected agent, which then takes over and manages the rest of the interaction.
In our example app, the router agent can choose from three different agents—each with their own role in helping members of the Mendix runner community become better runners. Here’s a quick breakdown of what each agent does:
- Running Coach Agent: This agent helps users build a training routine or marathon prep plan based on their goals.
- Nutritionist Agent: This one focuses on giving advice to improve nutrition, helping runners perform better or just be more aware of their eating habits.
- Running Facts Agent: This agent handles general running questions—like stats, fun facts, or anything outside the scope of coaching or nutrition. It also acts as the default agent when a question doesn’t fit the other two categories.
Getting started on the right foot
Mendix makes it super easy to get started with building your own agentic application—and the best way to jump in is with the Blank GenAI App. It comes preloaded with all the modules you need for a variety of models.
Already have an existing Mendix app? No problem. You can simply add the required modules—GenAI Commons, Conversational UI, and the Mx GenAI Connector—as long as you’re using Studio Pro 9.24.2 or higher. Just don’t forget to add the MxGenAIConnector.NAV_ConfigurationOverview_Open microflow to your app navigation.
Prompt engineering
The key to building a successful agent is getting the system prompt right—it’s what guides the agent’s behavior and decision-making. In the case of our router agent, the goal is simple: make sure each request gets sent to the right specialist.
- [System Prompt / Router] ‘You are an intent detection specialist. Your task is to classify the user intent on the last message of a conversation. If it is about sports diets, or nutritional information, return ” NUTRITIONIST ”. If it is about training plans or preparation for a sports event, return ”TRAINING”. If it is about general information about sport-related topic, return ”FACTS”. If it is about something not related to sports, return ”NONE”. Before you formulate your conclusion, make sure to consider the full conversation into account and extract the right context of the latest user message. You do not talk directly to the user, only specify the classification and your reasoning.
It’s essential that the router’s system prompt is clear and precise, since its output will be used programmatically in our microflow to decide which agent takes over the conversation. With that in place, we can shift our focus to the specialist agents. For these, we’ll keep things simple to start—each will have a straightforward prompt tailored to its specific area of expertise.
- [Running Coach Agent] ‘You are a running coach focused on providing a running plan to the user. Before providing recommendations, gather essential information: gender, age, target race type, and competition date. If any details are missing, ask the user. Include any additional questions you deem relevant for a comprehensive running plan’
- [Nutritionist Agent] ‘You are a sport nutritionist specializing in running diets. Before providing recommendations, gather essential information: gender, age, diet preferences, target race type, and competition date. If any details are missing, ask the user. Include any additional questions you deem relevant for a comprehensive nutritional plan.’
- [Running Facts Agent] ‘You are a running expert focused on providing running facts and advice to the user. To provide more insights, first provide the normal facts, and add another one considering the user’s age range and gender if available.’
Routing configurations
We’ll walk through how the routing example is configured, so you can use it as a reference when building your own agentic app.
We chose to use Mendix Cloud GenAI Resource Packs because they’re the fastest and easiest way to get started—no setup required, minimal maintenance, and zero operational hassle. Plus, we like to drink our own champagne (of course). If you want to try it out yourself, you can request access here.
Here’s how it all comes together in our example app: when a user sends a message in the chat (step 2 in the image above), a microflow is triggered behind the scenes. That’s where the Router Agent steps in. It looks at the conversation so far and decides which of the three specialist agents—Coach, Nutritionist, or Running Facts—should handle the request. Each one has a clear system prompt, so it stays focused on its specific area, and the microflow uses simple decision splits to send the request to the right place.
Crossing the finish line
Et voilà, your multi-agent system is up and running—just like you’re ready to hit the ground running! Mendix makes it easy to combine different agents into flexible multi-agent architectures to solve real-world problems.
In this example, we’ve leveraged the standard Maia for Smart Apps components and a couple of simple microflows to create a multi-agent routing system that helps guide our marathon training journey.
All much less arduous than actually running a marathon!