Four agents for a gym in Madrid
The agent team I built for a made-up gym for my UCD class: the case, what each agent does, the tech underneath, and how you know it works.
This month I taught a week on AI agents to business students at UCD. I didn't want to stand at the front and talk about agents in general, so I built a gym, gave it a problem, and then built a team of four agents to fix it. The students spent the week building their own version. This is the case, the four agents, the tech underneath them, and how I put them together.
The gym is called Gimnasio Zorro. It is made up, and so is everyone in it, but I made it as real as I could. It is a neighbourhood gym in Chamberí in Madrid, one floor of weights and machines and a studio for classes, open from 6am to 11pm. It has about 900 members. The owner is Marta. She opened it nine years ago, she still works the desk most mornings, and she knows a lot of the members by name.
Marta describes her gym like this: it is the gym you actually keep going to. It isn't the cheapest in Madrid and it isn't the biggest. It is the one where someone notices when you haven't been in.
And that is the problem. Marta knows from nine years of watching it that a member who stops coming for a few weeks usually doesn't renew. But she doesn't have the hours to go through 900 members every Monday, work out who is drifting away, and write each of them a proper email. So the thing Marta says makes her gym different is the thing she has no time to do.
That is the job I gave the agents. Every Monday, look at who came through the door, find the members who are coming less than they usually do, write each of them a short personal email in Marta's voice, send it, and then two weeks later count how many came back.
The gym has the data for this already. There is a door log with every swipe, a member list with each person's plan, the goal they gave when they joined and any notes from the desk, and a log of every email sent and every reply. I made all three for the case, with 900 members and twelve weeks of swipes, and I put the members into Attio, a CRM, because that is where Marta would look at them.
You could build this as one agent. I built it as four, because each part of the job needs something different, and it is easier to check four small jobs than one big one. I think of them as four people on staff. Each one has one job, reads a few files, and leaves its work in a place the next one knows to look. Here is how the work moves from one to the next.
Carlos goes through every swipe at the door and counts how many times each member came in, week by week, for the last twelve full weeks. From that he works out what is usual for each person, how many visits they made in the last three weeks, and how long it is since they were last in. He writes no emails and no words at all. He just counts, and he does it with plain code, not AI, because counting has one right answer.
Enrique reads Carlos's file and, for each member, makes one of three choices: send an email, leave them alone, or ask Marta. The rules for that are written out on his one page. A member is drifting if they came in fewer times in the last three weeks than they usually do in one week, they joined more than 28 days ago, they have been in within the last eight weeks, and nobody has written to them in the last 28 days. If the notes say they are injured, moving away or want to cancel, he asks Marta. If the notes say they are away on holiday, or they have always come once a fortnight, he leaves them alone.
When he does write, it is four sentences or fewer, in Marta's voice, to the member by first name, built on the goal they gave when they joined. Someone training for a half marathon gets a different email to someone who joined to get stronger as they get older. Enrique is the one that uses AI. He is Claude, given his page and Carlos's file, and he only looks at the members Carlos flagged as quieter than usual, so on a normal Monday that is around 80 people out of 900.
Cato's job is to assume Carlos and Enrique are wrong and prove it. He counts the visits again himself, from scratch, and makes his own choice for each member from Enrique's page, before he ever looks at what Enrique decided. Then he compares, and says agree or disagree for every member, with the reason. He also runs eleven named checks on every email, such as whether it uses the member's first name, whether it has one ask, and whether it mentions money. The counts, dates, names and money checks are code. The checks that need judgement, like whether the email fits the member's goal, go to Claude. If Cato disagrees, the email doesn't go out. It is held for Marta.
Rosa comes in two weeks after the emails and counts how many of those members have been back through the door since. She is plain code too. She writes one line for Marta at the top of her file, and under it the name and reply of every member who replied and hasn't been back, because those are for Marta to answer, not the agent. That number is the one Marta actually wants.
Nobody has to start any of this. There is a clock on the laptop, a small scheduled job, that wakes the team every 30 minutes and asks one question: has this Monday been done yet? Most of the time the answer is yes, or it isn't Monday, and it goes back to sleep. I did it that way because a laptop with its lid shut at 6am misses a 6am alarm and never makes it up, where a check every half hour catches the first moment the laptop is awake.
In class we ran the whole team on the students' own laptops, and for a gym the size of Marta's that could work. A laptop on the desk at the gym, left on, would do the job. The other option is to run it in the cloud, with something like Claude Managed Agents, where Anthropic hosts the agents on its own computers. Then nothing depends on a laptop being open, and the team runs on Monday morning whether anyone is in the building or not. You pay for what the agents use, so it costs more than a laptop that is already there, but for a business that can't have its agents stop when someone closes a lid, that is the way to go.
When the clock does start the team, a short runner script runs the four in order. Each one only counts as finished when the file it promised is actually there. If a file is missing, the runner stops, writes one line saying where it stopped, and nothing after it runs. Every step writes a line to a log, and that log is the proof it ran. This is the log from Monday 14 September, run on the made-up data, with nobody at the keyboard.
2026-09-14 08:34:20 monday=2026-09-14 start
2026-09-14 08:34:21 monday=2026-09-14 carlos ok as of 2026-09-14: 900 members read, 50 quieter than their own pattern (before judgment), written to agent/out/candidates-2026-09-14.json
2026-09-14 08:36:42 monday=2026-09-14 enrique ok looked at 83 | decisions: {'skip': 887, 'ask': 12, 'draft': 1}
2026-09-14 08:39:10 monday=2026-09-14 cato ok rows 900 | attacked by the model 65 | verdicts: {'agree': 900} | attacks listed: 28
2026-09-14 08:39:10 monday=2026-09-14 rosa skipped: returns-2026-08-31.json already exists
2026-09-14 08:39:17 monday=2026-09-14 attio decisions ok written 13 flags and asks for 2026-09-14
2026-09-14 08:39:50 monday=2026-09-14 attio returns ok written outcomes for 65 members; 28 returned
2026-09-14 08:39:50 monday=2026-09-14 done
The whole Monday took about five and a half minutes. Most of that is Enrique and Cato thinking. The last two lines are Rosa's work from two weeks before landing in the CRM: on 31 August the team wrote to 65 members, and 28 of them had been back through the door in the two weeks since.
There are a few rules I follow when I build an agent team, and this one has all of them in it.
Give each agent one job, and keep the counting and the writing apart. Carlos counts with code and gets the same answer every time. Choosing who to email and writing to them needs judgement, so that goes to Enrique, and he only ever works from Carlos's numbers. When one agent does both, mistakes creep in and they are hard to find, because every step after it still looks fine.
Every team needs a checker, and the checker does the whole job again on its own. Cato doesn't read Enrique's answers and decide whether they look right. He counts the visits himself, makes his own choice for each member, and only then compares the two. If he started from Enrique's answers, he would mostly end up agreeing with them.
An agent runs on its own. If a person has to start it, it is a command. So the team has a clock, each agent waits until the one before it has left its file, and a log records every step. Marta doesn't press anything.
The work goes where the person already looks. If an agent puts its work in a folder nobody opens, it hasn't really happened, even if the log says it ran. Marta reads Attio, so every agent writes its work onto the member's record there.
Write each job on one page, and make every part of it something you can check. Each agent's page says what it produces and in what exact shape, where it lands, how it knows it is done, and what it must never do. "When the members have been reviewed" can't be checked. "One row for every member, and a second run on the same Monday gives the same answer" can.
The emails are about the member's goal and their visits, and never their private life. The notes on a member's record can say all sorts of things, and an agent will use whatever it is given. But if I'm a gym sending emails to someone, I can't be talking about their sister's wedding. So the rule is in the job itself: no email names anything private.
And you only know it works when you have counted. I run the team on a Monday where I already know the right answers, count how many of its choices match, let Cato attack the result, change one line in a job page, and run it again. I stop when the number holds.
The students did well. By the end of the week every one of them had their own team of four agents running. The main thing they learned is that the key skill in building agents is solving problems. Things go wrong when you build something like this, and the people who get there are the ones who work through each problem as it comes up. They also found that when they got stuck, the best first place to ask was Claude. They told it what had gone wrong, and it helped them fix it.
The hardest bit was getting into the terminal itself, the black window where you type to Claude Code. For someone who has never used one it can feel daunting, but they all did it. And over time I think the terminal might not be needed at all. We could just be talking to our laptops, which is how I work now.
The same setup would work in most businesses. Every business has someone like Marta, who knows what should happen and doesn't have the hours to do it. The technology is ready now and it isn't complicated: a few files, some plain code, Claude for the parts that need judgement, a CRM and a clock. Most of the work is in the setting up and the testing. You have to decide exactly what each agent does and doesn't do, write that down on a page for each one, and then run it and count the results until they hold.