Loops

How do I catch an AI agent stuck in a loop?

A loop is the same step repeating on one run. Record each tool call and error with a name, a timestamp, and a run id, then look for that name stacked on the timeline. The last reply hides the repeat.

How to catch an AI agent stuck in a loop

You catch the loop by reading the timeline. AgentTracer stores the events you send. It has no loop detector, and the daily alerts are for the project, not for one run. A single weird step is on how do I debug my AI agent when it does weird things?

The four alert kinds and their default numbers are written out on how to monitor AI agents. A model-call record is on what is LLM observability? Other tools are on AI agent observability tools.

Steps

  1. Stop the loop in the agent. Set a maximum number of steps, or a maximum number of repeats of the same tool, and end the run when you hit it. A tracing product sees the loop only after those events exist. AgentTracer is not a proxy, so a model call never passes through it, and it cannot cut a request off in the middle.
  2. Record each repeat. Send one event per tool call and per error, with the tool name and a timestamp, on a single run id. A loop stays hidden if you only store the last message. Use type tool_call for a tool and type error for a failure. An event counts toward the error rate only when its type is error, any case. Up to 100 events can ride in one request, and the request body must stay under 1,000,000 characters.
  3. Read one run id. The same name, many times, on the same run id, is the loop. The project timeline shows the newest 100 events, newest first, with the run id under the name. There is no per-run page and no loop label. If the run wrote more than 100 events, the earlier repeats are not on that screen.
  4. Treat a volume spike as a hint. A check around 15:00 UTC flags a volume spike when the baseline average is above zero, the latest window has at least 20 events, and volume is at least 3× that average. The default window is 24 hours, compared with the previous 7 windows. The check is for the whole project, not for one run. A loop that multiplies calls can trip it. A busy day can trip it too.
  5. Know which alert is which. There is no loop detector. An error loop can show up as an error-rate spike when the latest window has at least 20 events, the error rate is at least 20%, and the rate is at least 2× the baseline. If the agent then sends nothing, that is a different alert: silence, after at least 5 events in the previous 24 hours and zero in the last 24 hours. Only events with an agent id count toward silence. Silence means it went quiet. It does not name the tool that was repeating.

The Monday digest, around 14:00 UTC, lists the top tool names for the trailing 7 days, plus recent errors and anomalies. A name at the top was used a lot. The digest does not call that a loop. You can turn the email off. The same summary is in the dashboard.

curl -sS -X POST https://agenttracer.net/api/v1/events \
  -H "Authorization: Bearer $AGENTTRACER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent":{"id":"support-bot"},"run":{"id":"run_01h"},"events":[{"type":"tool_call","name":"search_docs","timestamp":"2026-10-29T00:12:00.120Z","payload":{"query":"refund policy"}},{"type":"tool_call","name":"search_docs","timestamp":"2026-10-29T00:12:01.120Z","payload":{"query":"refund policy"}}]}'

Checklist

Signals that can mean a loop, and what AgentTracer actually does with each
What you seeWhat it isWhat AgentTracer does
Same tool name, many times, one run idThe loop. Read it off the timeline.Stores each event and shows the newest 100. It does not label the run as a loop.
Volume at least 3× the baseline, with at least 20 eventsA loop or a traffic burst. The alert cannot tell them apart.Daily volume-spike alert for the whole project.
Error rate at least 20% and at least 2× the baseline, with at least 20 eventsMaybe an error loop, if you recorded each error.Daily error-rate spike. There is no loop detector.
Zero events after at least 5 in the previous 24 hoursThe agent stopped. That is a different failure from a loop.Silence alert for that agent, and only when the events had an agent id.
One repeating run inside a busy projectEasy to miss if you only read the daily alert.No per-run loop check. The timeline is where that run shows up.

Questions

Does AgentTracer detect an agent stuck in a loop?

AgentTracer has no loop detector and no repeat counter. You see a loop as the same event name on one run id, in the project timeline. A daily volume spike or error-rate spike can be a side effect, and both are checked for the project, not for one run.

How soon does a loop show up in an alert?

The anomaly check runs once a day, around 15:00 UTC. It does not watch a run while it is happening. Read the timeline when a run looks wrong. Alert email defaults to 3 per user per UTC day, and you can turn alert email off. The anomaly row still stays on the project.

What should I send when a tool is repeating?

One event per call. Set the type to tool_call, set the name to the tool, set an ISO timestamp, set the run id, and keep the payload small. Do not send secrets. AgentTracer stores that JSON and does not redact it. The request body must stay under 1,000,000 characters, and one request can carry up to 100 events.

Can a loop use up the event quota?

A loop that sends an event per step spends the monthly event quota. Free is $0 and includes 50,000 events, plus 1,000 of grace, and then ingest stops. Pro and Team keep accepting events above the included amount, bill $5 per 100,000 events, and stop at a safety ceiling of 10× the included amount, plus that same grace. The ceiling limits the bill. It is not a loop detector. Prices and retention are on the pricing page.

Is a silent agent the same as a loop?

Silence is a different alert. It fires when an agent sent at least 5 events in the previous 24 hours and then zero in the last 24 hours. A loop that is still calling tools produces more events. The two checks are separate. A single weird step, rather than a repeat, is on How do I debug my AI agent when it does weird things?