closed beta · LangGraph, CrewAI & Claude Code supported · Book a Demo →
Home How It Works Frameworks Reports Claude Code FinOps FAQ GitHub Discord

How do I detect when my AI agents are stuck in an infinite loop?

When your agents pass work to each other in a cycle and nothing makes progress, that's a silent loop. Tracing tools show every individual call as successful — they don't watch the shape of the traffic between agents. AgentSonar does. The moment a Researcher → Writer → Reviewer → Researcher cycle crosses the threshold you set (default: 5 rotations), it fires an alert. You can also opt into Prevent Mode, which raises a typed PreventError and lets your code stop the run before the next LLM call.

Why are my CrewAI agents looping forever?

In CrewAI's hierarchical mode, a manager agent that's never satisfied with a worker's output can keep handing the same task back. AgentSonar catches this as repeated agent calls: when one agent calls another with the same task more than 5 times in a window, it fires an alert. Wire it in with two lines: from agentsonar import AgentSonarListener and listener = AgentSonarListener().

How can I stop my LangGraph agents from running forever?

LangGraph's recursion_limit catches infinite loops, but only after they've already happened — usually after 25+ iterations. AgentSonar catches the silent loop on rotation 5 by default, gives you a real-time alert, and (with Prevent Mode) raises a typed PreventError that stops the graph before the next LLM call. Wire it in with one line: graph = monitor(your_graph.compile()).

How much do runaway AI agents actually cost?

A reviewer-writer loop running overnight can burn $50–$500 in API calls. One public incident reported a $47,000 bill caused by two agents stuck in a loop for 11 days — weekly costs climbed from $127 to $18,400 before anyone noticed. That's exactly the pattern AgentSonar's silent-loop detection catches in real time, on rotation 5 by default. Cost-runaway projection is on the way.

What does AgentSonar actually catch today?

Eight failure classes, all shipped: silent loops, repeated agent calls, traffic spikes, redundant work (same tool, same args, zero new output), stuck tool calls (hung MCP server, tool that never returns), subagent explosion, failed-tool retry storms, and context-window cliff. None of these crash — they just burn tokens or stall the run. Tracing tools see them as healthy. Prevent Mode covers all eight.

Does AgentSonar work for single-agent systems and agentic RAG?

Single-agent coverage is shipped for Claude Code — every tool call and subagent in a Claude Code session is watched. For RAG pipelines and single agents on other frameworks, those are on the way. Today AgentSonar covers multi-agent systems (CrewAI, LangGraph, custom Python, custom Node, OMA sidecar) plus Claude Code.

Does AgentSonar work with the OpenAI Agents SDK?

A native OpenAI Agents SDK adapter is on the way. Today, use the custom Python path: pip install agentsonar, import monitor_orchestrator, and call sonar.delegation(source, target) wherever one agent hands off to another. Same detection. Two lines of glue code.

How is AgentSonar different from LangSmith, Helicone, or Langfuse?

AgentSonar is a failure detector, not a trace viewer. Tracing tools (LangSmith, Helicone, Langfuse) show you what happened: every LLM call, every prompt, every token. AgentSonar tells you when something is going wrong, while it's still going wrong, and optionally stops it. The two layers compose — use both.

Does AgentSonar collect any data from my machine?

agentSonar sends one anonymous session-start event per run: install ID (random UUID), version, Python version, OS, and adapter name. Never agent names, prompts, log content, or file paths. You can disable any time with AGENTSONAR_TELEMETRY=off, DO_NOT_TRACK=1, or config={"telemetry": False}. Full details and the exact wire format at Telemetry →

Still have a question? Email us or join the Discord — we respond fast.