Agent Guardrails
Defines guardrails for autonomous accounting agents covering prompt lifecycle, tool allow-lists, runtime enforcement, and incident response.
What this file does
Defines guardrails for autonomous accounting agents covering prompt lifecycle, tool allow-lists, runtime enforcement, and incident response.
When to use it
- Building AI agents that perform financial operations
- Establishing compliance controls for SOC 2 or GDPR
- Setting up monitoring and kill-switch procedures for agentic systems
- Defining a change management process for agent prompts
Assumes this stack
Agent Guardrails
Overview
Autonomous accounting agents accelerate reconciliations and reviews but must operate under strict guardrails to prevent financial misstatements, privacy incidents, and policy violations. This document defines the control framework spanning prompt hygiene, tool usage, monitoring, and incident response.
Roles & Responsibilities
- AI Platform Owner: Maintains guardrail policy, approves prompt revisions, and coordinates security reviews.
- Finance Systems Lead: Verifies agent outputs for ledger-affecting actions and ensures audit trail completeness.
- Security Engineering: Reviews new tools and data sources, manages secret distribution, and monitors anomalies.
- On-Call SRE: Owns runtime kill-switches and mitigations when guardrails trigger.
Prompt Lifecycle
- Version Control: All prompts stored in
packages/agents/promptswith semantic version tags and checksums recorded inagents-manifest.json. - Change Management: Pull requests modifying prompts require approval from AI Platform Owner and Security Engineering.
- Testing: Run regression suite
pnpm run test:agentsincluding prompt-injection, red-team scenarios, and deterministic output checks. - Deployment: Promote new prompt versions behind feature flags; monitor golden tasks before broad rollout.
Tool Allow-List
| Tool | Purpose | Data Scope | Notes |
|---|---|---|---|
ledger.query | Read-only ledger analytics | Tenant-scoped financial data | Enforces row-level security and read-only role |
journal.post | Create/update journal entries | Tenant financial records | Requires idempotency key and balanced entry validation |
evidence.attach | Upload supporting documents | Object storage (per-tenant) | Sanitizes metadata; PII redaction required |
notify.review | Send alerts to humans | Email/Slack endpoints | Logs template, recipients, and trace_id |
compute_vat_return | Deterministic VAT/GST calculations | Tenant tax data | Emits manifest hash + evidence IDs |
compute_income_tax | Deterministic corporate income tax calculations | Tenant tax data | Requires rate overrides for non-default jurisdictions |
compute_withholding_tax | Deterministic withholding tax calculations | Tenant tax data | Treaty rates must be explicit; emits manifest hash |
Any new tool must undergo STRIDE threat modeling and be added to this allow-list with documented scopes.
Data Minimization & Redaction
- Mask PII (SSNs, tax IDs, bank accounts) using the
redactSensitiveFieldsutility before prompts exit the secure boundary. - Summaries must exclude raw document contents unless explicitly approved.
- Financial values sent to LLMs must be rounded to reporting precision and tagged with currency.
Runtime Enforcement
- Policy Engine: Agents must call the policy check endpoint before executing side-effectful tools; responses include approval, deny, or require-human-review states.
- Rate Limits: Default 60 requests/minute per agent per tenant; override requires security approval.
- Circuit Breakers: Automatic disable when error rate exceeds 5% over 5 minutes or when policy denies exceed 3 in a row.
- Observation Hooks: Emit structured logs
{ trace_id, agent_id, tool, cost_usd, latency_ms, outcome }via OpenTelemetry spans. - Deterministic Manifest Alerts: Missing or invalid manifests emit
DETERMINISTIC_MANIFEST_MISSINGintotelemetry_alertsand surface in the Autonomy HUD.
Monitoring & Evaluation
- Golden task suite stored in
agents/evalswith expected outputs. - Weekly evaluation reports share win-rate trends, cost per task, and anomalies.
- Integrate evaluation metrics into Grafana dashboard with alerts when win-rate drops by >5% week-over-week.
Incident Response
- Trigger kill-switch (
AGENT_SAFE_MODE=1) via feature flag service. - Notify security, compliance, and finance owners.
- Collect prompt, inputs, tool outputs, and logs for forensic review.
- File incident ticket with severity classification (S0–S3) and follow SOC 2 post-incident workflow.
- Conduct root cause analysis, update guardrails, and document lessons learned.
Compliance Alignment
- SOC 2: Controls cover CC7 (Monitoring), CC8 (Change Management), and A1 (Availability) for agent components.
- GDPR: Ensure agents process minimum necessary personal data; maintain processing records.
- IFRS/GAAP: Human review remains required for material journal postings; agent outputs must be traceable to reviewers.
Roadmap (NICE-TO-HAVE)
- Differential privacy fine-tuning for summarization prompts.
- Cost anomaly detection using budget envelopes per feature flag cohort.
- Automated red-team LLM to continuously probe guardrails.
What's inside
7 sections: roles, prompt lifecycle, tool allow-list, data minimization, runtime enforcement, monitoring, incident response, compliance alignment, roadmap.
Change this for your project
- Replace
packages/agents/promptswith your own prompt directory - Replace
pnpm run test:agentswith your own test command - Replace
agents/evalswith your own evaluation suite path - Replace
AGENT_SAFE_MODE=1with your own kill-switch flag
Where it goes
Keep alongside your test suite. Used to define and score model evaluations.
Worth borrowing
- Tool allow-list with STRIDE threat modeling requirement
- Policy engine check before executing side-effectful tools
- Deterministic manifest alerts for missing or invalid outputs
Related Documents
IATA BCBP Standard Compliance
Documents which IATA BCBP fields and barcode formats a Swift library implements, including Version 8 gender code support.
Evaluating AI Agent Systems: Metrics, Benchmarks, and Quality Assurance (2024-2026)
Surveys 2024-2026 metrics, benchmarks, and monitoring tools for evaluating AI agent systems, with recommendations for a self-improving coding agent.
Voice AI Leaderboards, Benchmarks, and Evaluation Gaps (Jan 2025 -- Feb 2026)
Surveys 20+ voice AI benchmarks from Jan 2025, Feb 2026, identifies evaluation gaps, and provides leaderboard data for STT, TTS, and end-to-end voice agents.
LLM Evaluation — Deep Dive
Covers why LLM evaluation is hard, benchmark taxonomy, LLM-as-judge methodology, contamination, robustness, and designing an eval suite for a product.