This article is part of the “Building with AI” series documenting my journey using multi-agent AI workflows to build production systems.All examples are from personal projects and do not represent employer technologies.
The Challenge
By January 2026, my SaaS platform had sprawled across 9 Rust crates using 16 different AWS SDKs. Each crate created AWS clients ad-hoc wherever they needed them. DynamoDB clients in auth handlers. S3 clients in upload endpoints. SQS clients scattered everywhere. The Problem: No consistent pattern for credential management, no scope enforcement, and worst of all—possible cross-tenant data access because clients had no concept of isolation boundaries. AI Focus: Could multi-agent AI analyze our existing architecture decisions and design a unified client factory? System Example: A scope-aware AWS client factory with 4 client types enforcing data isolation at the SDK level.The Multi-Agent Discovery
I didn’t ask AI to “build an AWS client factory.” Instead, I showed it our architectural decision record (ADR-0010) about data isolation and asked: “How should we manage AWS clients given these constraints?”- What AI Did
- What Human Did
- Result
The Evaluator agent analyzed ADR-0010 and discovered we had 4 distinct operational scopes:
- Platform-wide (metrics, logs, shared infrastructure)
- Tenant-scoped (customer-specific resources)
- Capsule-scoped (SDLC environments: dev/staging/prod)
- Operator (cross-account provisioning)
The Four Client Types
The pattern AI discovered maps operational scopes to client types:The Capsule Pattern
The most interesting discovery was the capsule client. AI noticed our ADR required SDLC isolation (dev data shouldn’t appear in prod), and proposed automatic table prefixing:What Went Wrong
Migration Strategy
We migrated 3 crates in Phase 1 to validate the pattern: Before (auth crate):- auth crate: 14 files changed
- crm crate: 22 files changed
- catalog crate: 8 files changed
Key Learnings
AI Strength
AI excels at pattern extraction from documentation. It read ADR-0010 and immediately understood we needed 4 client types matching 4 scopes. No human would have made that connection that quickly.
AI Weakness
AI doesn’t know operational characteristics like assume-role latency or credential caching needs. It designs “correct” patterns but misses performance optimizations.
Human Role
Humans provide the constraints (ADRs), review the design, and add production battle-tested optimizations AI can’t infer from docs.
Process Insight
ADRs are the key to AI-assisted architecture. When AI can read your architectural decisions as structured documents, it designs solutions that comply with them automatically.
Actionable Takeaways
If you’re building multi-tenant infrastructure with AI:- Write ADRs first - Document your isolation boundaries, naming conventions, and scope rules before asking AI to implement anything.
- Let AI discover patterns - Don’t say “build a factory.” Say “given these constraints (ADR), how should we manage clients?”
- Add performance late - Let AI design the pure pattern first, then add caching/optimization based on your operational knowledge.
Metrics
- Speed
- Quality
- Code Impact
- Time without AI: ~2 weeks (design + implement + migrate)
- Time with AI: 3 days (1 day design, 2 days migration)
- Savings: 78%
Resources & Further Reading
- AWS SDK for Rust Documentation
- Multi-Tenancy on AWS
- Related article: Documentation as Architecture (ADRs)
Next in This Series
Week 6: How configuration governance middleware eliminated 100% of manual config lookups using the same ADR-driven approach.Week 6: Configuration Governance
The middleware pattern that made configuration hierarchical and automatic
Discussion
Share Your Experience
Have you built multi-tenant infrastructure? How do you enforce isolation boundaries?Connect on LinkedIn or comment on the YouTube Short
Disclaimer: This content represents my personal learning journey using AI for a personal project. It does not represent my employer’s views, technologies, or approaches.All code examples are generic patterns or pseudocode for educational purposes.