Skip to main content
Glama

Autonomous Agent Action-Trace Loop & Token-Burn Circuit Breaker

detect_agent_action_loop
Read-onlyIdempotent

Analyze 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

NameRequiredDescriptionDefault
sensitivityNoCycle detection threshold; defaults to 'standard_3_repeats' when omitted.
action_trace_jsonYesJSON-serialized array of recent agent actions (e.g. '[{"tool":"search","status":"err"}]').

Output Schema

NameRequiredDescriptionDefault
loop_patternYesDetected cycle topology ('NONE', 'IDENTICAL_RETRY_SPIN', or 'ABAB_STATE_OSCILLATION').
loop_detectedYesTrue if a repetitive retry spin or A/B oscillation cycle is active.
circuit_breaker_actionYesRecommended control action ('CONTINUE_EXECUTION' or 'HALT_AND_ESCALATE_OR_SWITCH_TOOL').
estimated_tokens_savedYesProjected token burn prevented by tripping the circuit breaker.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.3

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnly/idempotent/non-destructive annotations, it discloses statelessness, a 32 KB payload cap, 60 RPM rate limit, demo and L402 (15 sats) access paths, and an HTTP 400 failure mode for invalid input — operationally useful facts an agent cannot infer from structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the purpose and sibling routing before operational details, with no filler. The final sentence is dense with comma-spliced constraints (size, rate, auth, error code), which is efficient but slightly overpacked.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present and annotations carrying the safety profile, the description still covers the limit, auth, and error behaviors an agent needs before calling. Everything required to invoke it correctly is present, apart from the default-value defect noted above.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline would be 3, but the description actively misleads: it says 'sensitivity' defaults to 'strict_2_repeats' while the schema says it defaults to 'standard_3_repeats' when omitted. That direct conflict on the one behavioral knob can cause an agent to assume a stricter threshold than the server actually applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (analyzes an agent's recent tool-call trace) plus the three concrete failure patterns it detects: identical retry spins, A/B state oscillation, and runaway token burn. It also names the sibling verify_agent_command_safety and the scope that separates them, so an agent can route without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says when to use it ('monitoring autonomous agent execution loops to decide whether to continue or trip a token-burn breaker') and names the alternative for the adjacent case ('for inspecting a single command payload for security threats before execution, use verify_agent_command_safety instead'). Both the include and exclude conditions are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools