# How to avoid disaster when vibe-coding a billing engine — Andrew Garvin, Stripe

## Executive summary

Andrew Garvin discusses the complexities of building a billing engine, particularly when integrating advanced AI agents. He emphasizes that because billing involves deep business logic and real money, full autonomy is risky. The solution presented is using agentic tools (like Stripe Projects) to accelerate development into controlled test environments (sandboxes), rather than deploying directly to production. Key architectural components include portable 'skills files' for context and verbose error messaging for self-correction.

## Key takeaways

- Agent Guardrails are Essential for Billing: Billing carries deep business logic; therefore, the recommendation is to use coding agents only to accelerate development into a test environment (sandbox), not to ship directly to production. This minimizes risk when dealing with financial data.
- Skills Files Provide Contextual Guardrails: To manage complexity, Metronome uses an extensible set of portable 'skills files' that provide necessary context and API knowledge to the agent, removing friction during setup and evolution.
- Shift from Seats to Credits (Usage-Based Pricing): The rise of agents operating entire systems necessitates a shift away from seat-based pricing models toward usage-based credit systems. This is crucial because the value may accrue to a single agent/user, not a fixed number of logins.

## Technical details

- Stripe Projects CLI: This tool acts as an orchestrator, allowing users to provision a Stripe account and necessary backend services (e.g., Vercel, Postgres) through the Command Line Interface (CLI), enabling rapid product launch.
- Billing Engine Architecture (Metronome): The system handles complex usage billing, including prepaid credit auto-recharge models and multiple scoped credit pools: Build Credits, Plan Mode Credits, Cloud Credits, and AI Gateway Credits. This structure allows for granular tracking of different types of consumption.
- Agentic Workflow Best Practices: The goal is to use agents as a way to accelerate work into a test mode/environment (sandbox), rather than expecting the agent to operate the entire system autonomously in production. This requires designing for failure with verbose, self-correcting error messages.

## Practical implications

- When designing systems with deep business logic (e.g., billing, finance), implement mandatory sandbox environments accessible via CLI orchestration to test agent interactions safely.
- Architect services using granular, scoped credit pools rather than monolithic usage meters to accurately track consumption from different functional areas (AI calls vs. cloud compute).
- Develop developer tooling that explicitly guides AI agents by providing structured 'skills files' and anticipating failure modes to enable self-correction.

## Topics

Usage Billing, Agentic Workflows, Developer Experience, Fintech Architecture, Metronome, Stripe Projects, Lovable's pricing model

Source: https://www.youtube.com/watch?v=mJqwmmOx4WA
