How it works.
Detection ships with the SDK install. Prevent Mode is opt-in and stops a runaway loop in-process. Everything runs deterministically over the agent graph; no LLM is asked to evaluate anything.
What you get.
Four output artifacts per run, all computed from the coordination graph.
- Real-time alerts stream to stderr the moment a coordination failure is detected.
- Live JSONL timeline. Every event, flushed on write.
tail -fwhile your agents run. - Standalone HTML report on shutdown. No external CSS, no JavaScript, no network requests.
- Stable coordination fingerprints across runs. Correlate today's failure with yesterday's.
Prevent Mode.
Detection alone tells you what happened. Prevent Mode (opt-in) raises an exception the moment a tracked failure crosses the trip threshold, letting your code stop a runaway loop before the next LLM call.
from agentsonar import monitor_orchestrator, PreventError sonar = monitor_orchestrator(config={ "prevent": {"cyclic_delegation": True} }) try: while True: sonar.delegation("reviewer", "generator") # ... your agents run ... except PreventError as e: print(f"Stopped: {e.reason}") print(f"Cycle: {' -> '.join(e.cycle_path)}")
Available today for cyclic_delegation in the Custom Python, LangGraph, and OMA adapters. Off by default. Opt in with one config key. Coverage for every detector is on the way (see below).
Full Prevent Mode walkthrough →
On the way.
What's in active development. None of these are shipped yet; they're called out so you know where the project is going.
- TypeScript native engine. Electron and desktop integration without a Python sidecar. In development, day 7 of 15.
- Prevent Mode for every detector. Currently cycle-detection only. Sever any tracked coordination failure in-process before the next LLM call.
- Cost-Avoided Ledger. Per-customer, per-tool dollar attribution. CFO-facing dashboard.
-
Public schema spec.
agentsonar/agentsonar-specwith conformance fixtures so any implementer (Python, TypeScript, third-party) can verify behavior against a single source of truth. -
Full named failure mode coverage.
groundless_response,retrieval_thrash,mcp_retry_loop,cost_runaway. - React dashboard. Web UI on top of the JSONL timeline and HTML report.