Create Your Own AI Agent in Mendix
Building a doctor-appointment and insurance-claim agent with Mendix 11.12.2 and the Anthropic API
Introduction
Chatbots answer questions. AI agents get things done.
A chatbot can tell you how to book a doctor’s appointment. An agent can register you as a patient, find a doctor with an open slot, and book it. All of that happens in one conversation, with no forms.
I wanted to see how far a low-code platform could take this idea. In this post I’ll show how I built two AI agents in Mendix 11.12.2 using the Anthropic API:
- Doctor Appointment Agent: creates a patient, checks doctor availability, books an appointment.
- Insurance Agent: creates a policy, updates a policy, files a claim.
By the end you’ll understand the pattern well enough to build your own.
What makes something an “agent”?
An AI agent has three ingredients:
- A brain: the LLM (here, Claude through the Anthropic API) that understands the user and decides what to do next.
- Tools: actions the model is allowed to request, such as “create patient” or “book appointment”.
- A loop: the model asks for a tool, your app runs it, the result goes back to the model, and this repeats until the task is done.
The key point is that the LLM never touches your database directly. It only asks for a tool to be run. Your Mendix app runs the logic and stays in control of validation and security. That’s why Mendix fits this pattern well: every tool is just a microflow.
Architecture at a glance
Prerequisites
- Mendix Studio Pro
- An Anthropic API key (from the Anthropic Console)
- Basic knowledge of microflows, domain models and REST calls
Step 1: Getting an API key
To get started, make sure you head over to Anthropic and get an API key. In order to do this, you will need to configure billing for your account and ensure you have some credits loaded in order to generate tokens.
Step 2: Agent Builder Template
Create a new Mendix application and then select the Agent Builder Template
Step 3: Encryption Key
Once the app is downloaded, head over to app settings and change the default configuration. This is in order to set a value for the encryption key constant. Remember, a 32 character string is required.
Step 4: Design the domain model
I kept the model small, so the focus stays on the agent. I evaluated two AI agents — Insurance Data and Doctor Appointment — but feel free to test whichever one you prefer.
Step 5: Build the tools as microflows
Each capability the agent needs is a microflow with simple inputs and a clear text or JSON output.
1. Doctor Appointment:
‘{‘+
Get Mohamedbeemubeen’s stories in your inbox
Join Medium for free to get updates from this writer.
‘“status”:”success”,’ +
‘“message”:”Appointment successfully booked.”,’ +
‘“appointmentID”:”’ + $NewAppointment/AppointmentID + ‘“,’ +
‘“slotID”:”’ + $SlotTime/DoctorAppointment.SlotTime_slot/DoctorAppointment.slot/SlotID + ‘“,’ +
‘“appointmentTime”:”’ + formatDateTime($SlotTime/StartTime, ‘yyyy-MM-dd HH:mm’) + ‘“‘ +
‘}’
2. Insurance Date:
Step 6: Configure LLM Connection
After setting up the tools(microflows) and overview pages. Run the application and login as demo-administrator. At this point, we need to configure our LLM connection. In the Agent Builder Starter template, this is done at runtime, not directly through constants. To configure the claude, the process is the same as configuring for OpenAI or Azure OpenAI.
- Navigate to the LLM configuration section in the running app.
- Create a new configuration and select your provider.
- Enter your API key and then choose the model that you want to use
- Once this is done, your app isn’t connected to the claude and ready to generate responses.
- Now, we can finally create our agent
Step 7: Explore Agent
- Navigate to the Agent Configuration page
- Start configuring the Doctor Appointment Agent and Insurance Agent
For more reference: https://www.youtube.com/watch?v=tSb0EZJUg_U&t=7s
Benefits & Consideration
- Faster AI application development
- Natural-language user experience
- Reusable business logic through tools
- Security & authorization
- AI response accuracy and guardrails
Thank you! Ryan Mocke, for sharing such information, and special thanks to my manager, Tyler Stubbs(Nymbl, US), for encouraging and trusting me.






