Exact repeated tool calls
LoopDetector counts a normalized tool signature
inside a recent event window. Argument keys are sorted; their string values are
trimmed and lowercased. This is exact normalized matching, not fuzzy matching.
Defaults are three matching calls within 12 recorded events.
Possible decision: repetition alone normally produces warn. Repetition
combined with no-progress evidence can produce stop.
Semantic repetition
SemanticLoopDetector embeds tool argument values
and compares cosine similarity with recent tool decisions. If arguments are absent,
it uses the event’s action text. Defaults are similarity 0.8, a six-event window,
and three similar calls including the current call.
Possible decision: semantic repetition alone can recommend replan; with
no-progress evidence it can reach stop.
Semantic detection is opt-in for the default live integration. Install the semantic
extra and configure an OpenAI or Gemini embedding provider. The demo scenarios use
their own detector choices. See semantic setup.
Stalled or empty results
StallDetector checks for identical consecutive
result signatures, with patience four by default. ProgressDetector uses a default
three-result tail and checks identical outputs or an empty/error-like current result.
These are text heuristics; they do not understand your application’s completion criteria.
Possible decision: no progress alone normally recommends replan. Add repeated
tool calls, semantic repetition, or a repeating action cycle and the policy can stop.
Repeated failures
RepeatedFailureDetector classifies result text.
Tokens such as 401, 403, auth, permission, invalid, and schema suggest
permanent failure. Tokens such as 429, timeout, temporarily, and unavailable
suggest a retryable failure. The detector counts occurrences of the exact result
signature across the run, with a default threshold of two; they need not be consecutive.
Possible decision: permanent failure evidence reaches stop. Retryable failure
evidence alone stays below stop, allowing recovery. Long retries can still combine
with repetition and no-progress evidence to stop.
This is not HTTP exception inspection. A bare status code 503 is not a special
case; the demo’s temporarily unavailable text makes that result retryable.
Repeating action cycles
CycleDetector checks consecutive repeating sequences
of tool/handoff signatures with more than one distinct action. Defaults allow cycles
up to four actions long and require two cycles.
Possible decision: a cycle alone normally recommends replan. With no-progress
evidence, it can reach stop.
Multi-agent handoff loops
HandoffLoopDetector reads the optional caller
payload and the event’s node. It checks repeated closed cycles of directed handoffs.
Defaults are two repeats within 16 events, with cycle length at most five.
Possible decision: a repeated closed handoff cycle reaches stop with the
default policy. Repeated one-way handoffs do not count as closed cycles.
Saved traces can supply agent names and caller fields directly. Live callbacks use
fixed agent/tools node names, so attaching a callback does not automatically
reconstruct an arbitrary multi-agent topology. See trace fields.
Step and tool-call budgets
StepBudgetDetector counts recorded events;
ToolCallBudgetDetector counts tool-call events. Neither limit is enabled by
default. Both fire when the count is greater than the configured maximum.
Possible decision: an exceeded live budget reaches stop. In saved-trace check
mode, budget violations independently make the check fail. A saved-trace step is an
exported step, which can map to two internal events.