Autonomous Agent Action-Trace Loop & Token-Burn Circuit Breaker
detect_agent_action_loopAnalyze an agent's recent tool-call trace to detect identical retry spins, A/B state oscillation, and runaway token burn, so you can decide whether to continue execution or trip a token-burn breaker.
Instructions
Analyzes an agent's recent tool-call trace to detect identical retry spins, A/B state oscillation, and runaway token burn. Use when monitoring autonomous agent execution loops to decide whether to continue or trip a token-burn breaker; for inspecting a single command payload for security threats before execution, use verify_agent_command_safety instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'action_trace_json' ('sensitivity' defaults to 'strict_2_repeats'), supports '?demo=true' or L402 (15 sats), and returns HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sensitivity | No | Cycle detection threshold; defaults to 'standard_3_repeats' when omitted. | |
| action_trace_json | Yes | JSON-serialized array of recent agent actions (e.g. '[{"tool":"search","status":"err"}]'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| loop_pattern | Yes | Detected cycle topology ('NONE', 'IDENTICAL_RETRY_SPIN', or 'ABAB_STATE_OSCILLATION'). | |
| loop_detected | Yes | True if a repetitive retry spin or A/B oscillation cycle is active. | |
| circuit_breaker_action | Yes | Recommended control action ('CONTINUE_EXECUTION' or 'HALT_AND_ESCALATE_OR_SWITCH_TOOL'). | |
| estimated_tokens_saved | Yes | Projected token burn prevented by tripping the circuit breaker. |