AgentGate is a hackathon-stage spend governance gateway in front of paid tools.
It sits in front of paid HTTP endpoints so teams can safely let AI agents call paid tools with:
- agent identity resolution
- endpoint allowlists and pricing
- spend policy enforcement
- payment verification or demo-safe fallback
- idempotent retry protection
- invocation receipts for audit
- a dashboard that explains allowed, denied, and failed calls
AgentGate is not just a payment demo. It is a governance layer for paid agent tool usage.
- GitHub:
https://github.com/Lin-xun1113/AgentGate - Product demo video:
https://www.loom.com/share/3c11decf20054b7abaa95e288f289ca4 - Pitch video:
https://www.loom.com/share/bd0112ec37bd4e418977b2975a205e9f
The current MVP shows the core paid-agent governance loop:
- An agent calls a paid HTTP tool through AgentGate.
- AgentGate resolves the agent from its bearer token.
- The endpoint registry provides the target URL, price, and metadata.
- The policy engine checks allowlists, agent status, and spend limits.
- The payment adapter verifies a demo proof or uses configured demo fallback.
- Approved requests are forwarded to the upstream tool.
- Every path records an invocation receipt.
- The dashboard shows agent status, endpoint pricing, payment mode, receipts, and deny reasons.
Key demo scenarios:
payment_requiredwhen a paid call has no payment proofsuccesswhen a valid demo payment proof is providedpayment_invalidwhen payment verification failsendpoint_not_allowedwhen an agent calls a non-allowlisted endpointper_call_limit_exceededwhen endpoint price exceeds agent policy- idempotent replay protection with
Idempotency-Key upstream_errorwhen the paid tool fails after approval
- Go 1.22+
- Python 3
makecurl
In one terminal:
make demo-upstreamThe mock upstream serves demo paid tools on 127.0.0.1:8081.
In another terminal:
make runAgentGate listens on 127.0.0.1:8080 by default.
- HTML dashboard:
http://127.0.0.1:8080/dashboard - JSON snapshot:
http://127.0.0.1:8080/api/dashboard
In a third terminal:
make demo-flowRefresh the dashboard after the flow to inspect receipts, payment state, spend state, and deny reasons.
You can also run each scenario independently.
make curl-payment-required
make curl-success
make curl-success-tx-debug
make curl-idempotency-new
make curl-idempotency-replay
make curl-deny-endpoint
make curl-deny-per-call
make curl-payment-invalid
make curl-upstream-error
make dashboard-jsonFor a fuller operator walkthrough, see docs/demo-script-and-operator-guide.md.
curl -i \
-X POST "http://127.0.0.1:8080/invoke/http/wallet-risk" \
-H "Authorization: Bearer demo-agent-token" \
-H "Content-Type: application/json" \
-d '{"wallet":"abc"}'Expected result: 402 with a payment_required receipt.
curl -i \
-X POST "http://127.0.0.1:8080/invoke/http/wallet-risk" \
-H "Authorization: Bearer demo-agent-token" \
-H "PAYMENT-SIGNATURE: valid-demo-proof" \
-H "Content-Type: application/json" \
-d '{"wallet":"abc"}'Expected result: 200, upstream response, PAYMENT-RESPONSE, and a success receipt.
Run the same paid request twice with the same Idempotency-Key:
curl -i \
-X POST "http://127.0.0.1:8080/invoke/http/wallet-risk" \
-H "Authorization: Bearer demo-agent-token" \
-H "PAYMENT-SIGNATURE: valid-demo-proof" \
-H "Idempotency-Key: demo-safe-retry-1" \
-H "Content-Type: application/json" \
-d '{"wallet":"abc"}'Expected result:
- first request:
X-AgentGate-Idempotency-Status: new - second identical request:
X-AgentGate-Idempotency-Status: replayed - same key with a different body:
409 ConflictandX-AgentGate-Idempotency-Status: conflict
| Token | Agent behavior |
|---|---|
demo-agent-token |
Active demo agent allowed to call wallet-risk and tx-debug. |
demo-limited-token |
Active but not allowlisted for tx-debug; triggers endpoint_not_allowed. |
demo-cheap-token |
Allowlisted for wallet-risk, but per-call limit is below endpoint price; triggers per_call_limit_exceeded. |
AgentGate/
├── backend/ # Go backend, gateway, policy, receipts, dashboard
├── docs/ # demo guides, engineering notes, submission docs
├── openspec/ # specs and archived implementation changes
├── scripts/demo/ # mock upstream and scripted demo flows
├── AgentGate.md # product direction and current project state
├── Makefile # local run, test, and demo commands
└── README.md
Main backend modules live under backend/internal/:
auth/- agent identity resolutioncatalog/- endpoint registrydashboard/- dashboard UI and JSON snapshotgateway/- paid invocation orchestrationidempotency/- duplicate retry protectionpayment/- payment challenge, verification, and fallback behaviorpolicy/- allowlist, status, and spend policy decisionsreceipt/- invocation receipt recordingstore/- in-memory and SQLite-backed storage primitivesupstream/- HTTP upstream forwarding
The backend supports these environment variables:
| Variable | Default | Purpose |
|---|---|---|
AGENTGATE_ADDR |
:8080 |
API listen address. |
AGENTGATE_DEMO_UPSTREAM_RISK_URL |
http://127.0.0.1:8081/risk |
Wallet risk demo upstream URL. |
AGENTGATE_DEMO_UPSTREAM_TX_DEBUG_URL |
http://127.0.0.1:8081/tx-debug |
Transaction debug demo upstream URL. |
AGENTGATE_PAYMENT_MODE |
mock |
Payment mode, usually mock or configured. |
AGENTGATE_PAYMENT_DEMO_FALLBACK |
true |
Enables demo-safe fallback if configured verification is unavailable. |
AGENTGATE_PAYMENT_CONFIGURED_READY |
false |
Simulates configured verifier availability. |
See .env.example for a starter config.
make testThis runs the Go test suite under backend/ with a local cache directory.
AgentGate intentionally keeps the MVP focused. It is not trying to be a marketplace, a full MCP platform, a full finance backend, or a generic payment protocol layer.
The current product story is:
- govern paid tool calls by agent identity
- enforce spend and endpoint policy before forwarding
- avoid duplicate paid work during retries
- record auditable invocation receipts
- make outcomes understandable in the dashboard
The project uses OpenSpec for planning and change history. Archived changes live under openspec/changes/archive/, and main capability specs live under openspec/specs/.
Recommended implementation priorities after the current MVP:
- keep demo scenarios stable and reproducible
- preserve clear receipt states and deny reasons
- improve durable storage and receipt query UX
- avoid expanding into marketplace or full MCP platform scope too early