Advanced guide / Chapter 3 of 7
Loop detection and the kill switch.
The most expensive bug in agent systems is the quiet loop: an agent calls a tool, gets the same error, and tries again, all night. Nobody notices until the invoice. ACPpotamia compares each call with the session's recent calls and stops the session once it starts repeating itself.
How a match is decided
- ACPpotamia takes the last three messages of each call, tool calls and tool results included, and reduces them to a fingerprint.
- It masks numbers, timestamps and ids first, so "attempt 7 at 10:02" matches "attempt 8 at 10:03".
- An exact fingerprint match counts. So does a near match, where the estimated similarity is at or above your threshold.
Tuning it
| Setting | Default | Raise it when | Lower it when |
|---|---|---|---|
| Matching requests to stop at | 5 | agents legitimately poll the same tool | loops are costly (large models) |
| Time window | 60 s | agents are slow between steps | you want faster stops |
| Similarity | 0.92 | different questions look alike | loops vary their wording |
| Requests remembered | 16 | loops alternate several calls | rarely needed |
X-ControlPlane-Session-Id for each task (a ticket, a job, a conversation). Loop detection and session limits then stop only the stuck task, never your whole agent.The kill switch, at three levels
| Level | Stops | How |
|---|---|---|
| Session | One task | Console → Agents → Stop, or POST /v1/controlplane/kill with a sessionId |
| Team | Every agent on the team | Console → Overview → Stop all agents, or POST /v1/controlplane/kill |
| Organization | Every agent in every team | Console → Organization → Stop everything |
A stop applies to the next call, in every region. Calls that are already streaming are allowed to finish, and new ones get HTTP 429. When you revive a session its loop memory is cleared too, so it starts with a clean slate.
Stop and revive one session from your own tools
curl -X POST https://acp.examopotamia.com/v1/controlplane/kill \
-H "Authorization: Bearer acp_your_admin_key" \
-d '{"sessionId":"ticket-99812","reason":"retrying a broken tool"}'
curl -X POST https://acp.examopotamia.com/v1/controlplane/revive \
-H "Authorization: Bearer acp_your_admin_key" \
-d '{"sessionId":"ticket-99812"}'
Be told when it happens (Enterprise)
Add a webhook on the Limits page and ACPpotamia will send you session.killed and team.killed events, signed with HMAC-SHA256. Use them to page whoever is on call or to open a ticket. The user guide shows how to verify the signature.