AI agents in production: treat every event as a possible repeat
Two production faults in a live multi-agent system taught the same lesson. Assume every incoming event may be a duplicate or an echo of your own action, and trace every run so you can prove what happened.
I designed and run a system where four AI agents turn emailed meeting requests into booked meetings, with no person in the loop. They read the request, work out what the sender wants, check calendars, book the slot, and afterwards write the minutes and raise follow-up tasks.
It works. But the two faults it hit in production were not about the AI being clever or not. They were about something much older: events that arrive more than once.
Where repeats come from
The system reacts to new email through push notifications rather than checking the inbox on a timer. That choice means requests are handled as they arrive. It also means accepting a well-known property of push systems: a notification can be delivered more than once.
Agents add a second source of repeats that ordinary software rarely has: echoes. An agent that sends an email is also changing the inbox it watches. If nothing stops it, its own reply can look like a new request and set the whole pipeline off again.
Both faults we hit came from exactly these two things:
- An agent’s own reply re-triggered its inbox, so the system responded to itself.
- Repeated deliveries of one message could be processed as if they were separate requests.
Each was fixed, and the second is now detected automatically. But the lesson is the part worth sharing.
The rule: every handler must be safe to run twice
If an event can arrive twice, the code that handles it has to produce the same result whether it runs once or several times. In practice that means:
- Record what you have already handled. Keep the identifier of each processed message and check it before acting. A repeat becomes a no-op.
- Recognise your own actions. Mark everything the system sends, so an echo is identified and ignored rather than treated as new work.
- Make actions themselves repeat-safe where possible. Booking the same slot for the same request twice should find the existing booking, not create a second one.
None of this is specific to AI. What makes it urgent with agents is that nobody is watching each step. A person would notice they were replying to their own email. An agent will not, unless you build that in.
Why tracing turned guesses into fixes
Both faults were diagnosed from traces, not from guesswork. From the start, every agent run was recorded with structured metadata and a status, instead of plain application logs. When something went wrong, the question “which runs were triggered by our own messages?” became a query with an answer.
Two decisions made that possible:
- One job per agent, under one orchestrator. Each step fails in its own way. Separate agents give you a failure rate per agent and keep a fault inside one stage, instead of one large agent where everything blurs together.
- An agreed set of fields on every trace. Tools can only answer the questions the data supports. I later built monitoring tools that let a coding agent query these traces directly, and they depend on those fields being written on every run.
What I would do from day one
If I started again, I would build loop and repeat protection before the first agent went live, and agree the trace fields before the first run was recorded. Treating every inbound event as a possible echo or duplicate from the beginning would have prevented both faults. Fields added later cannot answer questions about older runs.
The short version
- Assume every event may arrive twice, and some may be your own echo.
- Make every handler safe to run twice.
- Trace every agent run with structured fields, agreed up front.
The multi-agent platform write-up covers the architecture, and the observability servers write-up shows how those traces are queried.