This page traces the full lifecycle of a single agent-initiated payment: from the operator publishing a policy through to the audit row that proves it happened. Each arrow in the diagram below names the actor and the action; each step below the diagram shows the schema instance on the wire at that moment.Documentation Index
Fetch the complete documentation index at: https://glide-9da73dea.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Sequence diagram
Step-by-step schema instances
Step 1 — operator publishes AgentPolicyEnvelope
The operator configures which vaults an agent can touch, what amounts it can move, which chains and counterparties are allowed, and when the policy is active. Whenever any field changes,policy_version increments. All downstream grants and verifications key off this monotonic counter.
Step 2 — agent requests a grant from the OAuth AS
The agent authenticates usingclient_credentials (server-to-server) or an authorization-code flow (user-delegated). It specifies the vault it wants to access via an RFC 8707 resource indicator and requests the minimum scope set needed.
ap-agent-acme-prod is a registered principal for this vault, reads the current policy_version, and signs the JWT.
Step 3 — OAuth AS issues ScopedGrantClaims (JWT)
Step 4 — agent makes an MCP tool call
Step 5 — MCP server validates the grant
@glideco/grant-wrapper runs seven checks in order (see ScopedGrantClaims — Validation contract) before the tool handler runs. If any check fails, the tool call returns JSON-RPC error -32001 (auth failure) or -32003 (step-up required) without touching the policy engine or the DB.
Step 6 — policy engine evaluates the envelope
@glideco/policy-engine receives the current envelope (fetched fresh from DB and cached by (vault_id, policy_version)) plus the tool call parameters. It evaluates every configured axis in deterministic order and returns one of three verdicts:
| Verdict | Meaning |
|---|---|
allow | All caps satisfied; proceed. |
allow_with_step_up | Amount exceeds step_up_amount_cents; principal must complete biometric step-up before the tool can execute. The gateway returns JSON-RPC -32003 with a step_up_url. |
deny | Hard cap exceeded, counterparty not on allowlist, geo blocked, or MCC blocked. Call rejected. |
Receipt — only an AgentActivityEvent with eventKind: 'risk_verdict' and eventKind: 'policy_violation'.
Step 7 — receipt written after settlement
receipt is returned in the JSON-RPC result body and also persisted in activity_log.
Step 8 — F4 trigger writes AgentActivityEvent
The Postgres trigger fires on theactivity_log INSERT and writes an AgentActivityEvent projection — agent-activity rows live in activity_log via the agent-platform columns added by migration 0042. This is the F4 IRON RULE: no application code writes audit rows directly.
audit:stream subscribers tail this table in real time.
Schema cross-reference
| Schema | Where it lives in the flow |
|---|---|
AgentPolicyEnvelope | Published by operator before the flow starts; policy_version threads through every subsequent schema. |
ScopedGrantClaims | JWT issued by OAuth AS at step 3; carried as Bearer token; re-validated at step 5. |
Grant | Same wire format as ScopedGrantClaims; the developer-facing explanation of each JWT claim. |
Receipt | Written at step 7 after settlement; on_chain_tx is server-fetched, never from facilitator body. |
AgentActivityEvent | Written by Postgres trigger at step 8; append-only, no DELETE path. |
_types | uuidV4, amountCents, chainId, isoDateTimeUtc, agentScope, etc. referenced by every schema above. |
Reading list
- OAuth flow — the
client_credentials→ JWT exchange in full detail. - Money-safety contracts — the IRON RULES (F3, F4, F5) that each lifecycle step enforces.
- AgentPolicyEnvelope — all 14 policy axes and their evaluation order.
@glideco/policy-engine— the open-source reference implementation of step 6.