anlyon-agent-loop
The Agent Skill for handling what an Anlyon call returns inside an agent loop: waiting for approvals, connect prompts, refusals, unknown outcomes and idempotent retries.
anlyon-agent-loop teaches your coding agent what to do with each result an action call can return, in your code, in Vercel AI SDK tools and over MCP. The point is the moves an agent must not make: invoking a parked call again, retrying an outcome that may already have happened, or treating a 200 as success when the body says the call was refused.
What it teaches
- A table of every status and grade, with the next move for each: report, wait, ask the user to connect, tell the user why it was refused, or stop and hand an
unknownto a person. - A loop in TypeScript that invokes with an idempotency key tied to your business operation, waits with
approvals.waitForDecision, then reads the invocation. - The AI SDK results from
@anlyonhq/ai-sdk:pending_approval,connect_required, refusal codes and limits, andanlyon_check_requestafter the user decides. - The MCP flow:
list_actions,action_<name>,wait_for_approvaluntil the decision arrives, andrequest_approvalfor a step that is not an action. - Retrying on purpose:
retryOfwith a new key after afailed, reconciling anunknownbefore anything else, and the two idempotency conflicts.
When it loads
When code or prompts deal with actions.invoke, waitForDecision, wait_for_approval or check_approval, anlyon_check_request, AI SDK tool results, idempotency keys, or an invocation that is pending_approval, failed, unknown, denied or expired.
What’s inside
| File | Holds |
|---|---|
SKILL.md |
The result table, the loop, the AI SDK and MCP flows, retries |
references/results.md |
The invoke response, receipts, AI SDK and MCP result shapes |
LICENSE |
MIT |
Download: anlyon-agent-loop.zip.
Install
npx skills add https://docs.anlyon.com --skill anlyon-agent-loop
Try it
Our worker calls
refund-orderthrough Anlyon. Make it wait for the approval, and make sure a restart can never refund twice.
When the Anlyon tool says the user has to connect Slack, show a Connect button in the chat instead of an error.
Write the system prompt section that tells our agent how to treat Anlyon results.

