Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Agent Loop Detector

agent.loop_detect

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
No network

Overview

You send 2 to 5,000 events with action, optional target, stateFingerprint and outcome. window (2-200, default 20) and repeatThreshold (2-20, default 3) bound the search. similarity EXACT uses all four fields; ACTION_TARGET ignores state and outcome. We pick the earliest span, then the shortest cycle. We do not stop an agent or judge task success.

An agent that retries the same click against an unchanged page burns quota without a typed loop signal.

Reliability

Deterministic earliest-then-shortest selection; no clock or network. LOOP_EVENTS_INVALID — trigger: fewer than 2 events or an unknown similarity; retryable: no; next: send two or more closed events. LOOP_EVENT_LIMIT_EXCEEDED — trigger: more than 5,000 events; retryable: no; next: window the trace.

Context footprint

Span indices and cycle length only. A successful call costs 1 execution credit.

When to use it

When a trace of actions might be cycling and you want the earliest shortest span.

When you need to halt the agent, compare embeddings, or explain why the task failed.

Scope

Note
Detects repeated action/state spans in a bounded agent event list using EXACT or ACTION_TARGET similarity.

Non-goals

  • Does not stop an agent
  • Does not use embeddings
  • Does not judge task success

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysis

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive input, safe output
What this means

This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response does not contain submitted content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
eventsarrayYesBounded array of 1 through 10001 events; runtime requires 2 and accepts at most 5000.
windowintegerNoCycle length ceiling from 2 through 200. Omit it for 20.
repeatThresholdintegerNoConsecutive copies required, from 2 through 20. Omit it for 3.
similaritystringNoEXACT or ACTION_TARGET. Omit it for EXACT.

Output schema

FieldTypeRequiredDescription
loopDetectedbooleanYesWhether a span met the threshold.
similaritystringYesApplied similarity rule EXACT or ACTION_TARGET after defaulting.
windowintegerYesApplied cycle-length ceiling after defaulting omitted values.
repeatThresholdintegerYesApplied consecutive-copy threshold after defaulting omitted values.
cycleLengthintegerYesChosen cycle length, or 0.
confidencestringYesNONE, MEDIUM or HIGH for the chosen span.
eventIndicesarrayYesBounded array of 0 through 5000 indices covering the chosen span.
spansarrayYesBounded array of 0 through 8 chosen spans; v1 reports at most one.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"agent.loop_detect","input":{"events":[{"action":"a"},{"action":"a"},{"action":"a"}]}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("agent.loop_detect", {"events":[{"action":"search","target":"web","outcome":"ok","stateFingerprint":"s1"},{"action":"click","target":"r1","outcome":"ok","stateFingerprint":"s2"},{"action":"search","target":"web","outcome":"ok","stateFingerprint":"s1"},{"action":"click","target":"r1","outcome":"ok","stateFingerprint":"s2"},{"action":"search","target":"web","outcome":"ok","stateFingerprint":"s1"},{"action":"click","target":"r1","outcome":"ok","stateFingerprint":"s2"}]});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
LOOP_EVENTS_INVALID400NoThe request payload failed this skill's input validation.
LOOP_EVENT_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not stop an agent
  • Does not use embeddings
  • Does not judge task success
  • Halting a running agent
  • Semantic similarity of free text

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "agent.loop_detect",
  "input": {
    "events": [
      {
        "action": "search",
        "target": "web",
        "outcome": "ok",
        "stateFingerprint": "s1"
      },
      {
        "action": "click",
        "target": "r1",
        "outcome": "ok",
        "stateFingerprint": "s2"
      },
      {
        "action": "search",
        "target": "web",
        "outcome": "ok",
        "stateFingerprint": "s1"
      },
      {
        "action": "click",
        "target": "r1",
        "outcome": "ok",
        "stateFingerprint": "s2"
      },
      {
        "action": "search",
        "target": "web",
        "outcome": "ok",
        "stateFingerprint": "s1"
      },
      {
        "action": "click",
        "target": "r1",
        "outcome": "ok",
        "stateFingerprint": "s2"
      }
    ]
  }
}

Examples

A search-click cycle repeating three times

Inputjson
{
  "events": [
    {
      "action": "search",
      "target": "web",
      "outcome": "ok",
      "stateFingerprint": "s1"
    },
    {
      "action": "click",
      "target": "r1",
      "outcome": "ok",
      "stateFingerprint": "s2"
    },
    {
      "action": "search",
      "target": "web",
      "outcome": "ok",
      "stateFingerprint": "s1"
    },
    {
      "action": "click",
      "target": "r1",
      "outcome": "ok",
      "stateFingerprint": "s2"
    },
    {
      "action": "search",
      "target": "web",
      "outcome": "ok",
      "stateFingerprint": "s1"
    },
    {
      "action": "click",
      "target": "r1",
      "outcome": "ok",
      "stateFingerprint": "s2"
    }
  ]
}
Expected outputjson
{
  "spans": [
    {
      "start": 0,
      "end": 5,
      "cycleLength": 2,
      "repeats": 3
    }
  ],
  "confidence": "MEDIUM",
  "cycleLength": 2,
  "eventIndices": [
    0,
    1,
    2,
    3,
    4,
    5
  ],
  "window": 20,
  "repeatThreshold": 3,
  "similarity": "EXACT",
  "loopDetected": true
}
Tip
The earliest span of length 2 meets the default threshold of 3.

Same action with changing state is not an EXACT loop

Inputjson
{
  "similarity": "EXACT",
  "events": [
    {
      "action": "search",
      "target": "web",
      "outcome": "ok",
      "stateFingerprint": "a"
    },
    {
      "action": "search",
      "target": "web",
      "outcome": "ok",
      "stateFingerprint": "b"
    },
    {
      "action": "search",
      "target": "web",
      "outcome": "ok",
      "stateFingerprint": "c"
    }
  ]
}
Expected outputjson
{
  "spans": [],
  "confidence": "NONE",
  "cycleLength": 0,
  "eventIndices": [],
  "window": 20,
  "repeatThreshold": 3,
  "similarity": "EXACT",
  "loopDetected": false
}
Tip
stateFingerprint differs, so EXACT reports no loop.
  • Catch a search-click cycle before another retry
  • Ignore state changes when only action and target repeat

Avoid for

  • Halting a running agent
  • Semantic similarity of free text

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

analysisagentvalidation