Architecture Overview
Conto is designed as a secure, scalable control center for AI agent financial operations.System Architecture
Core Components
SDK Layer
TypeScript SDK that agents use to request and execute payments. Handles authentication, policy pre-checks, and transaction submission.
Policy Engine
Evaluates payment requests against configurable rules. Supports spend limits, time windows, counterparty restrictions, and more.
Wallet Manager
Manages stablecoin wallets for agent payments. Handles key management, balance tracking, and spend limit enforcement.
Agent Registry
Identity management for AI agents. Tracks permissions, SDK keys, and activity history.
Payment Flow
Evaluate
Policy engine checks all applicable rules:
- Spend limits (per-tx, daily, weekly, monthly)
- Time windows
- Counterparty restrictions
- Category rules
Data Flow
Write Path (Payments)
Read Path (Queries)
Technology Stack
Frontend
Frontend
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- TailwindCSS - Utility-first styling
- shadcn/ui - Component library
- Recharts - Analytics visualization
Backend
Backend
- Next.js API Routes - Serverless API endpoints
- Prisma ORM - Type-safe database access
- PostgreSQL - Primary database
- Redis - Rate limiting and caching
Blockchain
Blockchain
- Stablecoins - For secure payments
- viem - Ethereum library
- wagmi - React hooks for Ethereum
Infrastructure
Infrastructure
- Vercel - Deployment platform
- Neon - Serverless PostgreSQL
- Upstash - Serverless Redis
Design Principles
1. Defense in Depth
Multiple layers of protection:2. Fail-Safe Defaults
- New agents start with minimal permissions
- Unknown counterparties require verification
- Exceeding limits blocks transactions (doesn’t just warn)
- Expired SDK keys are immediately rejected
3. Auditability
Every action is logged:4. Separation of Concerns
| Concern | Owner |
|---|---|
| Identity | Agent Registry |
| Authorization | Policy Engine |
| Funds | Wallet Manager |
| Execution | Transaction Engine |
| Observability | Audit System |
Scalability
Horizontal Scaling
- Stateless API servers (Vercel serverless)
- Connection pooling (Prisma + PgBouncer)
- Read replicas for analytics queries
Performance Optimizations
- Policy evaluation cached per request
- Balance reads cached with short TTL
- Batch transaction confirmations
- Background trust score updates
Reliability
Transaction Safety
Idempotency
- Payment requests have unique IDs
- Duplicate execute calls return existing result
- Retry-safe API design