Multi-Agent LLM Systems in Production: Four Safeguards
A multi-agent demo works when everything goes right. Production is about what happens when a model call hangs, a job retries, or a conversation runs long. These are the four safeguards I added to FloatChat.
01The setup
FloatChat is a self-hosted customer-support platform built on Chatwoot 4.13. Customers write in over live chat, email, WhatsApp, social or SMS, and a multi-agent AI layer answers the routine questions from the company's own knowledge base.
The flow is simple to describe. A message arrives, a listener checks that the inbox has an AI assistant attached, and a reply job is queued on Sidekiq. An orchestrator assistant reads the conversation and either answers or hands off to a scenario agent. Agents can call tools: a semantic FAQ lookup over pgvector, labels, priority, private notes, resolve, and handoff to a human.
Each of those steps is a place where a real system can fail. Four failures mattered most.
02Four failures, four safeguards
A slow model call blocks the queue
Agent runs happen in background workers. If an LLM call hangs, the worker hangs with it, and every customer behind it waits. The fix is an LLM timeout guard: a slow call fails fast instead of stalling Sidekiq workers.
A retry sends the same reply twice
Background jobs retry, which is what you want for reliability. But a retried agent run can post a duplicate answer or repeat a tool action, such as adding the same label or note again. A Redis run registry tracks each run and prevents duplicate replies and repeated tool actions.
Long conversations outgrow the context window and the budget
Agents that hand off to each other can also loop. Every run is capped at 8 handoffs, 12 tool calls and 30 messages of history, and long messages are truncated before they reach the model. A hard ceiling makes the worst case predictable in both latency and cost.
Nobody can tell what the agent did, or why
When a customer gets a strange answer, "the model decided" is not a useful explanation. A run logger records every agent run, so a bad reply can be traced back to the handoffs and tool calls that produced it.
03Always leave a way out to a human
The safeguards above keep the system stable. They do not make the AI right every time, so the most important tool an agent has is the one that stops it: human handoff.
When the AI cannot help, the conversation leaves bot mode, gets an activity note explaining what happened, and is auto-assigned to a human agent with free capacity. The customer is never stuck talking to a bot that has run out of answers.
04Let it learn, but review what it learns
FloatChat mines resolved conversations for new FAQ entries, which is how the knowledge base keeps up with what customers actually ask. Left unchecked, that loop could also teach the system its own mistakes.
So new entries are saved as pending for review rather than going live, and they are de-duplicated against the approved ones. The system proposes; a person approves.
05Takeaways
- Put a timeout on every model call that runs inside a worker.
- Make agent runs safe to retry, so a retry never repeats a reply or a tool action.
- Cap handoffs, tool calls and history per run, and decide the numbers on purpose.
- Log every run so you can explain any reply after the fact.
- Give the agent a clean handoff to a human, and keep people in the loop for anything it learns.
The full architecture, stack and feature list are in the FloatChat case study.