How to use this tool

Spend Controls Configurator — Guide

A walkthrough of every setting in the Spend Controls Configurator: what each limit does, how safety rails interact, how the approval workflow generates infrastructure, and what to do with the exported policy and Terraform output.

What is this tool for?

An agent that can execute payments without limits is a significant operational risk. A single software bug, misconfigured retry loop, or malicious prompt injection could drain funds before any engineer notices. The Spend Controls Configurator generates the configuration and infrastructure that caps what an agent can spend — and stops it automatically when limits are hit.

The tool addresses Agent Safety Layer 6 — the financial guardrails layer in a defence-in-depth architecture. Other layers handle identity (Layer 1), network segmentation (Layer 2), idempotency (Layer 3), and observability (Layer 5). This layer ensures that even if all other controls fail, there is a hard financial ceiling on what an agent can execute autonomously.

The output is a policy JSON document plus Terraform HCL that creates the DynamoDB spend counters, CloudWatch alarms, and Step Functions approval workflow your agent needs at runtime.


Step-by-step walkthrough

Step 1 — Select agent type and currency
  1. Click one of the 6 agent type chips at the top: Payment Router, Fraud Detector, Settlement Agent, Refund Agent, Compliance Checker, or Webhook Processor. This pre-loads sensible default limits for that agent's typical transaction profile.
  2. Enter an Agent Name — this appears in the generated output as a label to identify which agent instance this configuration belongs to.
  3. Select a currency (GBP, USD, EUR, AUD, or CAD). All limit values in the generated output will be denominated in this currency. For multi-currency systems, generate a separate configuration per currency.
Step 2 — Configure spend limits
  1. Per-transaction limit: the maximum value of a single payment the agent can execute. Any payment intent above this value is automatically rejected before execution. Set this to the highest single payment your agent legitimately needs to process.
  2. Daily limit: the cumulative total the agent can spend in a 24-hour rolling window. Enforced via an atomic DynamoDB counter. When this is hit, all further payments are blocked until the window resets.
  3. Monthly limit: the cumulative total for the calendar month. Useful for budget control — e.g. a reconciliation agent that should not process more than £500k in bulk payouts per month.
  4. Hard cap: an absolute ceiling that cannot be overridden by any retry or approval mechanism. This is your final safety net. Set it conservatively — you can always raise it, but it is much harder to explain a breach to a regulator.
Step 3 — Configure safety rails
  1. Cooldown period: minimum seconds between consecutive executions. Prevents runaway loops where an agent retries the same failed payment at full speed. For most payment agents, 30–60 seconds is appropriate.
  2. Max retries: how many times the agent can attempt the same payment before giving up and escalating. Works in combination with cooldown — 3 retries at 30-second cooldown means 90 seconds maximum retry window before human escalation.
  3. Freeze on breach: when enabled, hitting the hard cap sets a frozen flag on the agent's DynamoDB record. Your agent must check this flag before each execution. A frozen agent requires manual intervention to re-enable — it will not auto-unfreeze.
  4. Alert on approach: enables a CloudWatch Alarm that fires when spend reaches a percentage of the daily limit (you set the threshold). Use this for early warning — e.g. alert at 80% so your team can investigate before the limit is hit.
Step 4 — Configure approval workflow
  1. Approval threshold: any single transaction above this value requires approval before execution. This is separate from the per-transaction limit — it is the value at which the approval workflow kicks in, not where payments are blocked.
  2. Approval method: choose None (fully autonomous), Step Functions (programmatic waitForTaskToken pause), Human Review (SNS notification to a reviewer), or Dual Auth (two independent approvers required). The Terraform output changes significantly based on this choice.
  3. Escalation channel: where approval requests are sent. Options are SNS (generic pub/sub), PagerDuty (incident-based), Slack (webhook), Email, or SQS Queue. For PCI DSS compliance, use SNS or PagerDuty — they provide an audit trail of notification delivery that you can show to a QSA.
  4. The Escalation timeline panel (below the dropdowns) shows a readable prose description of the exact sequence of events when an approval is triggered. Review this to confirm the workflow matches your runbook.
Step 5 — Export and deploy
  1. Switch between Policy JSON and Terraform HCL tabs. The JSON is your runtime configuration document. The HCL creates the AWS infrastructure.
  2. Store the policy JSON in SSM Parameter Store or a DynamoDB config table. Your agent reads it at startup and validates each transaction against it before execution.
  3. For Terraform: place the .tf file in your infrastructure repo. Definevar.approval_lambda_arn pointing to your approval handler. Run terraform init && terraform apply — this creates the DynamoDB table, CloudWatch alarms, and Step Functions state machine.

Understanding the Live Limit Summary

The four stat cards at the top of the tool (Per Transaction, Daily, Monthly, Hard Cap) update in real time as you move the sliders. They give you a quick visual sanity check — for example, ensuring your monthly limit is at least 30× your daily limit, or that your hard cap is not lower than your per-transaction limit.

A common configuration mistake is setting a daily limit that cannot be reached in practice because the per-transaction limit is already so low. For example: a £500 per-transaction limit with a £200 daily limit — every transaction would be blocked after the first one. The live summary helps you spot these misconfigurations before generating output.


Key terms

Hard CapAn absolute spend ceiling that cannot be overridden. When hit, the agent is blocked regardless of any approval or retry logic. It is the last line of financial defence.
Cooldown PeriodThe minimum wait time between consecutive payment executions by the same agent instance. Prevents runaway retry loops that could exhaust limits in seconds.
waitForTaskTokenAn AWS Step Functions integration pattern where a state machine pauses at a task state until an external process sends a task token back. Used to implement human-in-the-loop approval without polling.
DynamoDB Atomic CounterA DynamoDB UpdateItem operation with a condition expression that increments a counter only if the result would not exceed a limit. Enables consistent spend tracking across concurrent Lambda invocations.
Dual AuthAn approval pattern requiring two separate individuals to independently approve a transaction before execution. Required by some regulatory frameworks for high-value transfers.
Freeze on BreachA safety mechanism that sets a frozen flag on an agent's config record when it hits its hard cap. The agent must check this flag before each execution and refuse to proceed while frozen.
Agent Safety Layer 6The financial guardrails layer in an agent defence-in-depth architecture. Sits above identity (1), network (2), idempotency (3), secrets (4), and observability (5) layers.

Frequently asked questions

Ready to configure spend controls for your payment agent?
Set your limits, configure safety rails, and export your policy and Terraform in under 3 minutes.