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.

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.