Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview
On this page

How Anlyon runs your agent's production calls

Understand what happens between your agent naming an action and the request reaching a production API, which checks every call passes, and which errors your agent can meet on the way.

Anlyon lets your AI agent act in your users’ own accounts, and your company’s, safely. Your agent does not perform the production operation. It names an action and passes input, and Anlyon performs the operation on its behalf.

Everything else in these docs follows from that one move, so it is worth being precise about it before anything else.

Without Anlyon

your agent  ->  an API credential in your process  ->  production API

The model is driving a process that holds a live key. Whatever sits between a stray sentence in a scraped web page and a real refund is code you wrote and have to remember to run on every path. There is nothing outside your process that can refuse, pause, cap or attribute the call, because by the time anything could look at it the request has already left.

With Anlyon

your agent  ->  a named action  ->  Anlyon  ->  production API

You define the call once, referencing credentials rather than pasting them. From then on your agent’s side of the boundary contains no URL, no header and no key:

import { Client } from '@anlyonhq/sdk';

const anlyon = new Client({ apiKey: process.env.ANLYON_API_KEY! }); // calls https://api.anlyon.com

await anlyon.actions.invoke('refund-order', { charge: 'ch_3P9x', amount: 12000 });

Anlyon owns what happens next.

Why let Anlyon make the call

  • Risk. The model never holds a key, cannot change the destination with its input, and cannot skip an approval, because the code that would skip it is not in your process. A halted environment sends nothing.
  • Cost. A key can carry a monthly cap on invocations, and every governed write counts against the impact limits you set on money and other quantities before it is sent. A retried request with the same idempotency key replays the first outcome instead of repeating the operation.
  • Effort. You do not write approval queues, credential storage, retry bookkeeping or an audit trail for each tool. You define the action once and every caller gets the same checks.

Follow an invocation from name to request

Every invocation passes the same checks, in this order. Nothing here is optional per call. What varies is whether a given stage has anything to do.

Check the caller's authority

Invoking needs actions:invoke. Referencing a secret is checked when the action is saved, and needs secrets:read, because a reference is a use. No key receives secrets:read by default.

Reserve budget

When the calling key has a monthly cap on action invocations, the call is checked and reserved against it. Past the cap the invocation stops with 429 BUDGET_EXCEEDED.

Resolve the action and its version

The name resolves to an action in the calling key’s environment. If the call is attributed to a run whose agent pins a version of that action, the pinned definition runs. Otherwise the current definition runs. The response reports which one actually executed.

Evaluate policy

Approval policies are evaluated on every invocation, so a policy can tighten the gate and not only relax it. A policy scoped to an identity the request does not carry is treated as indeterminate and requires approval, so withholding attribution is not a way around it.

Park for a human, if required

A gated invocation returns 202 with pendingApproval: true and an approval id. The request that the approver reviews is frozen at this point, so editing the action while they decide cannot change what their yes sends.

Resolve credentials and build the request

Immediately before dispatch, Anlyon re-checks that the environment is not halted, decrypts the referenced secrets, interpolates them into the frozen definition, re-validates the destination, and sends the request. A workspace secret is decrypted here, at dispatch. The read-back of a governed action resolves it again under the same bindings.

Record the outcome

The invocation records the response status, the action version that ran, and the run and span it belongs to. Where the outcome cannot be confirmed it says so rather than guessing. A governed action also returns a receipt grade. See Receipts and grades.

Handle what a call can answer

Errors use one envelope, { "success": false, "error": { "code", "message", "details" }, "requestId" }. The TypeScript SDK throws an AnlyonError with status, code, details and requestId; the Python SDK raises a typed error.

Answer What happened What to do
200 The request was sent and the invocation records its outcome. Read the invocation’s status and response.
202 with pendingApproval: true A policy holds the call for a person. Nothing has been sent yet. Wait for the decision with approvals.waitForDecision(), or tell the user it is waiting.
402 PAYMENT_REQUIRED The workspace has no plan, so no action is dispatched. Choose a plan. See Billing.
409 ENVIRONMENT_HALTED The environment’s kill switch is on. Nothing was sent. Wait for an operator to resume it. See Environments.
429 BUDGET_EXCEEDED The calling key’s monthly cap is spent. Raise the key’s budget, or wait for the month to reset.
429 QUOTA_EXCEEDED The plan’s monthly action allowance is used up. See Billing.

A problem found at dispatch, such as a secret that no longer exists or a connected account that needs to be reconnected, does not answer an error status. Nothing is sent, the invocation is recorded as failed, and its error says why. Every status and code an invocation can answer is listed in Handle invoke errors.

Why this is the interesting part

The controls Anlyon offers are not a separate product sitting alongside your agent. They are consequences of owning the call:

Know the boundary of these claims

All of the above applies to actions routed through Anlyon’s hosted executor. A tool your own code calls directly, with a credential your own process holds, is not routed through Anlyon and is not governed by it.

The SDK also ships a local approval gate, approvals.gate(), which wraps one of your own functions and waits for a decision before it runs. It is useful when a call cannot move, and it is a different thing: your process still executes the call with your credential, so it gives you the human decision and the record, not credential isolation, and Anlyon cannot attest that your function ran or did not. See Local approval gates.

Where to go next

Was this page helpful?