As of today, Delegus works there too. Put it in front of a web API, whatever language it's written in, and every request gets checked against the authority behind it before your API sees it. If the agent is allowed, the request goes through with a receipt attached. If it isn't, your API never hears about it and the agent is told why.
A gateway for any API#
The new gateway sits in front of your API. You don't add any Delegus code to the API itself. It can be Java, Go, Python, or something older than all three.
DELEGUS_RP_KEY=dk_rp_… npx @delegus/http-gateway \
--upstream http://api:8080 --public-base-url https://pay.example.com --route-map routes.jsonThe route map tells Delegus what a request actually means. For a payment endpoint, you point it at the field that holds the amount and the field that holds the payee. That way Delegus can ask the real question, which is whether this agent may pay this payee this amount right now. Whether it may call /payments at all is the easy part.
{ "version": 1, "routes": [
{ "id": "payments.create", "method": "POST", "path": "/payments",
"action": "commerce:purchase",
"resource": "payee:{arg:/body/payee}",
"amount": { "value": "/body/amount", "currency": "/body/currency", "unit": "minor" } }
] }Here's what happens to each request.
- Allowed. It's forwarded with the exact bytes that were checked and a
Delegus-Receipt-Idheader. - Refused. The API never sees it; the caller gets a 403 with the reason and the receipt.
- Missing proof of grant. The caller gets a 401 telling it what to present.
And if Delegus can't be reached, the gateway refuses the request. We'd rather block a payment than let one through unchecked.
If your API runs on Node, you can skip the extra hop and use the same check as middleware: delegus.http() for Express-style servers, or a Fastify hook. Both are in @delegus/sdk 0.3.1.
One payment, step by step#
Acme gives its procurement agent authority in a grant signed with Acme's own key: pay approved vendors, up to $25,000 a payment, until the end of the year. SupplierPay runs an ordinary payments API with the Delegus gateway in front of it.
- The agent asks. It sends
POST /paymentsfor $12,000 to VendorCo. With the request go two things: Acme's grant, and a proof of grant, signed by the agent for this exact request. - The gateway reads the request. The route map says this route is a purchase, the payee is
vendorco, and the amount is $12,000. - Delegus checks. Is the grant really signed by Acme, still in date, and not revoked? Did this agent sign the proof of grant for this exact request, just now, for the first time? Is a purchase allowed, is VendorCo an approved payee, and is $12,000 within $25,000?
- Allowed. The gateway forwards the request to SupplierPay's API with a receipt id. The payment goes through.
- The agent tries $40,000. Refused, over its limit. SupplierPay's API never sees the request, and the agent gets the reason and a receipt.
- Acme takes the agent's authority back. From the next request on, anywhere, the agent is refused.
- Months later, a dispute. Either side can show the signed receipt. Anyone can check it offline against Delegus's published key, without trusting Acme or SupplierPay.
Why this matters#
Think about it from the receiving end. An agent you've never met, working for another company, asks your system to move money. You can see who's calling. What you can't see is whether anyone at that company actually said yes to this payment, at this amount, today. Their logs won't settle it for you, because they're their logs. You need to be able to check for yourself.
We ran the whole thing against a test bank we built for it. A treasury agent tried four payments. One was over its limit. One went to a payee its company had never approved. One came after the company had already taken the agent's authority back. Those three never reached the bank. The fourth went through with its receipt, and the bank's own log shows exactly one call.
Also out today#
- Claude Code as the agent.
@delegus/agent-proxyruns on your machine, holds the agent's key and grant, and signs a proof of grant for every tool call. Claude Code connects to it with one line:claude mcp add --transport http tools http://127.0.0.1:8787/mcp. - A safer MCP gateway.
@delegus/mcp-gateway0.3.1 takes one--endpoint, the exact address agents call and sign for. If the setup can't line up, it refuses at startup and says how to fix it, instead of refusing every call later. - Python agents can sign their own calls.
delegus-mcp0.3.1 addsmcp_headersfor the agent side, on top of the server middleware it already had.
Try it#
- Check an agent's authority in front of any API
- MCP servers
- The free sandbox at delegus.ai: signup to your first signed receipt in under a minute.