AWS Builder Center
KavachPay: Building a financial control plane for autonomous AI agents on AWS

KavachPay: Building a financial control plane for autonomous AI agents on AWS

Autonomous agents can request financial actions, but credentials alone do not express scope, budget, expiry, delegation, or revocation. This article shows how KavachPay uses bounded authority, deterministic decisions, atomic reservation, human step-up, and causal replay before payment-provider execution.





KavachPay: Building a financial control plane for autonomous AI agents on AWS

An agent with access to a payment API can make a request. That does not mean it should be able to decide how a user's money may be used.
The missing layer is authority.
A credential can authenticate a call, but it does not express a spending scope, a budget, an expiry, a delegation path, a revocation, or the reason a request was allowed. KavachPay was built around that gap.
KavachPay is a software control plane that governs and records the financial authority of autonomous agents. Agents request financial actions. KavachPay evaluates the authority behind those requests. A payment provider executes the payment.
The current project demonstrates provider execution through Razorpay TEST MODE using ₹0 real funds. KavachPay is not a bank, wallet, payment gateway, payment aggregator, or production settlement system. That boundary is part of the architecture.

The problem is authority, not authentication

An autonomous agent may be authenticated and still be unauthorized to perform a particular financial action.
Before a payment provider is called, a financial control plane needs to answer questions such as:
  • Which agent is asking?
  • On whose authority is it acting?
  • What scope applies to this request?
  • How much authority remains?
  • Has an ancestor mandate expired or been revoked?
  • Would this request overspend a shared budget when another request arrives at the same time?
  • Should the request proceed automatically, require a human decision, or stop?
  • Did the provider actually execute anything?
Authentication alone does not answer these questions.
KavachPay therefore treats financial authority as a first-class system state that can be evaluated before execution and reconstructed afterward.

A control plane between intent and execution

KavachPay separates three concerns that are easy to collapse into a single payment call:
  1. Agent intent: what the agent is asking to do.
  1. Software authority: the mandates, grants, limits, scope, expiry, and lineage that govern the request.
  1. Provider execution: what a third-party payment provider actually does.
That creates a clear responsibility split:
AGENT
-> requests a financial action
KAVACHPAY
-> resolves and governs authority
PAYMENT PROVIDER
-> executes the payment in the configured environment
The agent receives authority, not payment credentials.
The frontend follows the same boundary. It is a control-plane interface, not a payment credential store, and it does not access DynamoDB directly.

Representing authority as a bounded graph

KavachPay models a human-approved root mandate and delegated grants.
A root mandate can define a payment profile, while child grants inherit the root payment source. A child grant can narrow its parent's scope, budget, expiry, or delegation settings. It cannot choose a new funding source or expand the authority it received.
The central invariant is:
effective(child) = min(residual(child), effective(parent))
Authority can travel down the graph. It cannot multiply on the way down.

Figure 1. Authority universe traces each active agent back to the principal while exposing granted, consumed, and remaining capacity.
Consider a documented example.
A Shopping root mandate has ₹20,000 and delegates ₹2,000 to a Grocery Agent. After the Grocery Agent consumes ₹1,249, its residual child capacity is ₹751, while the root still has ₹18,751 remaining.
A new ₹1,850 request cannot become valid merely because the root still has capacity. The child's effective authority is constrained by both its own remaining authority and the authority available through its parent.
This is different from handing an agent a payment credential and expecting downstream services to reconstruct policy later. The authority itself is explicit, inspectable, and tied to the request that consumes it.

Deterministic decisions before provider execution

KavachPay resolves the caller and authority path before provider execution.
The documented decision path is:
verify caller
-> resolve authority path
-> reject revoked or expired ancestors
-> check scope
-> check single-transaction limit
-> check effective capacity
-> check window budget
-> check split-pattern constraints
-> reserve budget
-> evaluate policy
-> return ALLOW, STEP-UP, or DENY
A key design decision is that an AI model is not the final financial authorization authority.
AI may assist with extraction, drafting, or explanation. The financial authorization path itself is deterministic.
The resulting states are explicit:
  •  ALLOW  — the request satisfies the applicable authority constraints.
  •  STEP-UP  — one-time human approval is required.
  •  DENY  — the provider must not be invoked.

Figure 2. Decision Feed records ALLOW, STEP-UP, and DENY outcomes with policy reasons and provider state.
The API surface exposes these states directly. Relevant operations include creating intents, approving step-up requests, retrieving decision records, and requesting causal replay.
The objective is not merely to calculate a decision. Operators need to understand what the system actually decided.

Turning decisions into an operator surface

The frontend exposes the control-plane state through surfaces such as:
  • Authority universe
  • Mandate Studio
  • Agent authority
  • Decision Feed
  • Step-up approvals
  • Causal Replay
  • Payment Methods
  • Attack Labs
The real dashboard shows authenticated-user grants rather than merging synthetic scenario data into the user's graph.
That distinction is important.
A demonstration environment becomes misleading when seeded test records appear indistinguishable from actual account state. KavachPay therefore treats empty states, sandbox records, and provider state as part of the product contract.
Payment profiles follow the same principle. A test profile can explicitly display:
  • Razorpay
  • TEST MODE
  • Simulated Test Profile
  • ₹0 real funds
It should never imply that KavachPay stores real card credentials.

The concurrency problem: reserve before calling the provider

The most important part of a spending limit is what happens when requests race.
Suppose an authority has ₹500 remaining.
At nearly the same time:
Cafe intent -> ₹500
Books intent -> ₹500
A naive read-then-write implementation could allow both requests to observe the same remaining balance.
Both could appear valid.
That would mean the spending limit worked only when requests arrived one at a time.
KavachPay therefore reserves authority before provider execution.
For each relevant budget counter, the reservation checks the current consumed value against the remaining limit.
Conceptually:
current consumed <= grant.limit - requestedAmount
The reservation uses a conditional transactional write in DynamoDB.
If one request reserves the remaining capacity first, the competing request fails the condition. The outcome therefore does not depend on which provider request happens to finish first.
The reservation path also rechecks expiry and authority state at the point of action.
This matters because authorization cannot rely on a background cleanup task eventually noticing that a mandate has expired.
KavachPay also supports configured split-pattern constraints so aggregate spending can be evaluated rather than treating every transaction as an isolated event.

Step-up is narrow. Revocation is forward-looking.

The current sandbox demonstrates STEP-UP with a ₹650 Mobility Agent request against a ₹500 automatic threshold.
A human can approve that specific intent.

Figure 3. A one-time step-up approval releases the ₹650 sandbox payment without changing the standing mandate.
The approval does not permanently increase the agent's standing limit and does not create new root authority.
That distinction is essential.
A one-time exception should remain a one-time exception.
Revocation works in the other direction.
When a parent grant is revoked, dependent descendants become non-executable on subsequent authorization.
Revocation changes what may happen next.
It does not automatically reverse a payment that has already been executed by a provider.
A revoked mandate is not a refund mechanism.

Authorization is not execution

KavachPay keeps authorization and payment execution explicitly separate.
The system uses states such as:
AUTHORIZED_BY_KAVACHPAY
PAYMENT_CREATED
EXECUTED
FAILED
 AUTHORIZED_BY_KAVACHPAY  means the authority engine approved the intent.
It does not mean Razorpay captured a payment.
The payment service resolves the payment profile, validates the intent and reservation, acquires an execution lock, invokes the Razorpay adapter, records provider identifiers when they actually exist, and waits for authenticated webhook evidence.
Duplicate execution is controlled using intent identity, provider identity, and execution state.
The webhook path preserves the raw request body for signature verification and validates details such as:
  • event identity
  • order ID
  • amount
  • currency
  • intent state
  • payment ID consistency
Duplicate provider events are handled by provider event identity.
The current payment path uses Razorpay TEST MODE with synthetic or simulated profiles and ₹0 real funds.

Figure 4. The execution profile is explicitly marked Razorpay TEST MODE, simulated, and ₹0 real funds.

Why these AWS services exist

The AWS architecture is a set of boundaries, not a list of logos.
Amazon Cognito authenticates human users. The authenticated Cognito  sub  becomes the tenant identity for protected operations.
AWS Amplify hosts the Next.js/React control-plane interface.
Amazon API Gateway provides the public API boundary between clients and the backend.
AWS Lambda runs the TypeScript/Node.js backend and its authority, payment, audit, and reconciliation logic.
Amazon DynamoDB stores the authority graph, grants, intents, decisions, budget counters, payment-profile references, and replay/audit state.
AWS KMS provides cryptographic integrity and authenticity evidence behind decision receipts. The intended claim is tamper-evident evidence, not legal immutability.
AWS Secrets Manager stores provider secrets and other sensitive configuration. Agents and frontend clients do not receive provider secrets or raw payment credentials.
Amazon CloudWatch provides operational visibility for the serverless runtime.
AWS CDK defines the infrastructure deployment workflow.
The machine-to-machine agent path remains separate from human authentication. KavachPay defines an integration boundary for agent-facing tool access without replacing the application's own financial authority graph.

Causal Replay: answering why, not only when

Traditional logs are useful for answering when an event occurred.
They do not necessarily answer why an intent reached a particular state.
KavachPay exposes a Causal Replay view that can connect evidence such as:
COMMAND
-> TASK
-> INTENT
-> MANDATE
-> PAYMENT_PROFILE
-> DECISION
-> PROVIDER_RESULT
The graph depends on what actually happened.
If an intent was authorized but never sent to the provider, the replay should say so explicitly.
If an intent was denied:
PROVIDER - NOT INVOKED
If an authorized sandbox intent was never executed:
EXECUTION - NOT EXECUTED
Provider order, payment, webhook, or capture identifiers appear only when those records genuinely exist.

Figure 5. Causal Replay distinguishes authorization from execution and traces the outcome through authority state and mandate provenance toward the originating intent.
This turns evidence into more than chronological logging.
An operator can move backward from an outcome to the decision, from the decision to budget and authority state, and from authority lineage toward the original request.
The purpose is a reproducible explanation of why the state transition happened.

Security boundaries that match the product boundary

KavachPay has three useful trust boundaries:
  1. User boundary — identity and payment setup.
  1. KavachPay boundary — authority, policy, reservations, decision state, and evidence.
  1. Provider boundary — payment execution in the provider's environment.
The security model considers risks including:
  • cross-tenant access
  • forged identity
  • delegated authority amplification
  • replayed intents
  • duplicate provider execution
  • stale authorization
  • revoked authority execution
  • malformed webhooks
  • callback spoofing
  • payment-profile substitution
  • concurrent spending
  • fake execution evidence
Controls include Cognito identity, authority resolution, monotonic delegation, revocation checks, DynamoDB transactional reservation, idempotency identifiers, webhook signature verification, Secrets Manager, and KMS-backed evidence.
Attack Labs demonstrates these concepts only in authorized synthetic and sandbox environments.

Figure 6. At the time of capture, Attack Labs shows eight authorized synthetic sandbox scenarios completed with observed results matching their expected outcomes.

What we learned building the control plane

The first lesson is that financial authority needs its own data model.
Authentication answers who is calling. It does not answer what that caller may spend, where, for how long, or through which delegated path.
The second lesson is that delegation must be monotonic.
Authority should become narrower as it moves outward, not expand.
The third lesson is that concurrency belongs inside the authority model.
A spending limit that works only when requests arrive sequentially is not a reliable limit.
The fourth lesson is that evidence needs to preserve causality.
A list of timestamps can show that events occurred. It cannot necessarily explain how authority, policy, reservation, execution, and provider state combined to produce the result.
Finally, the payment boundary should remain explicit.
KavachPay demonstrates a financial authority control plane and a provider integration in TEST MODE. That narrower claim is useful because it states exactly what the system governs and what remains outside it.

What's next

The current implementation calculates live exposure from active authority.
Historical exposure snapshots are a future capability. A complete historical graph would persist timestamped exposure events and apply the same canonical exposure model to both current and historical state.
Other future work can extend the same boundaries through additional protocol adapters, provider environments, and operational evidence.
The guiding question remains:
Does the capability improve bounded authority, deterministic authorization, safe execution separation, or causal explanation without changing the product's claim boundary?
All interface captures used in this article depict KavachPay's authorized synthetic sandbox. Razorpay is shown in TEST MODE with ₹0 real funds. No real payment credentials are reproduced.
Explore the deployed   KavachPay  sandbox to see bounded authority, step-up approval, Causal Replay, and the verified Attack Labs scenarios in action.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article