What I Built
AgenticForkSquad (AFS) is an AI-powered database query optimizer that uses multi-agent collaboration to automatically improve slow SQL queries.
The system leverages Tiger Cloud's zero-copy forks to create isolated testing environments for three specialized AI agents (powered by Google Vertex AI):
π§ Cerebro Agent (gemini-2.5-pro): Strategic planner & quality assurance
β‘ Operativo Agent (gemini-2.5-flash): Code generator & execution specialist
π§ Bulk Agent (gemini-2.0-flash): High-volume operations optimizer
Each agent analyzes the query in its own Tiger Cloud fork, proposes optimizations, runs benchmarks, and competes in a consensus engine that evaluates:
Performance improvement (50%)
Storage efficiency (20%)
Code complexity (20%)
Implementation risk (10%)
The winning optimization is automatically applied to the main database, and all forks are cleaned up.
Demo
π Live Application: https://agentic-fork-squad.vercel.app
π GitHub Repository: https://github.com/HCo-Innova/AgenticForkSquad
π Documentation: See docs folder for complete architecture
Quick Start
Login with test credentials
Submit a query: SELECT * FROM tasks WHERE status = 'pending' ORDER BY created_at DESC
Watch real-time WebSocket updates as 3 agents process in parallel
Review consensus decision with benchmarks
See optimized query applied
Tiger Cloud Features Showcase
β
Zero-Copy Forks (Core Feature)
Every task creates 3 isolated database forks instantly:
// Real fork creation via Tiger MCP
forkID, err := mcpClient.CreateFork(ctx, mainService, "fork-cerebro-task1")
// Returns pre-created fork: gwb579t287 (Agent 1) or mn4o89xewb (Agent 2)
MCP enables programmatic fork management, making multi-agent workflows possible.
β
Multi-Agent Collaboration
Three agents work in parallel forks:
Cerebro analyzes query patterns in fork-cerebro
Operativo generates optimizations in fork-operativo
Bulk tests scalability in fork-bulk
All running simultaneously on Tiger Cloud without blocking each other.
β
Real PostgreSQL Features
Full access to Tiger Cloud's PostgreSQL 16:
Information schema introspection
EXPLAIN ANALYZE for benchmarks
Index creation/deletion in forks
Transaction isolation testing
Journey & Tech Stack
Architecture
Backend: Go 1.21 with Fiber v2 (Clean Architecture pattern)
Frontend: React 18 + TypeScript + Vite + Tailwind CSS
Database: Tiger Cloud PostgreSQL 16
AI: Google Vertex AI (3 Gemini models)
MCP: Tiger Cloud MCP Server
Real-time: WebSocket Hub for live updates
Workflow
User submits slow query
β
Router assigns 3 agents based on query complexity
β
TaskProcessor creates 3 Tiger Cloud forks via MCP
β
Orchestrator executes agents in parallel (10min timeout each)
β
Each agent: Analyze β Propose β Benchmark in its fork
β
ConsensusEngine scores proposals (multi-criteria)
β
Winner applied to main DB
β
Forks deleted (cleanup)
β
WebSocket broadcasts completion to UI
Key Implementation Details
Fork Management:
type MCPClient struct {
fork1URL string // gwb579t287 (pre-created)
fork2URL string // mn4o89xewb (pre-created)
mainURL string // wuj5xa6zpz
}
We use persistent pre-created forks to ensure reliability. Each agent gets assigned a dedicated fork ID.
Consensus Scoring:
func (ce *ConsensusEngine) Decide(
proposals []*OptimizationProposal,
benchmarks []*BenchmarkResult,
criteria ScoringCriteria,
) (*ConsensusDecision, error)
Weighted scoring prevents agents from over-optimizing single metrics.
Real-time Updates:
// 11 WebSocket event types
EventTaskCreated
EventAgentsAssigned
EventForkCreated
EventAnalysisCompleted
EventProposalSubmitted
EventBenchmarkCompleted
EventConsensusReached
EventOptimizationApplied
EventTaskCompleted
EventTaskFailed
EventConnectionEstablished
Users see every step of the multi-agent workflow live.
Why Tiger Cloud Made This Possible
Before Tiger Cloud: Multi-agent database testing required:
Complex database replication setup
Manual fork management
Storage costs for duplicated data
Synchronization headaches
With Tiger Cloud:
One line of code creates a fork: CreateFork(ctx, parent, name)
Zero storage overhead (copy-on-write)
Instant creation (no wait time)
Perfect isolation (agents can't interfere)
MCP standard (works with any MCP client)
This project would be impractical without Tiger Cloud's zero-copy forks. Traditional database cloning would make parallel agent execution too slow and expensive.
What's Next
Hybrid search integration (pg_text) for query pattern matching
PITR (Point-in-Time Recovery) for rollback testing
Agent learning from previous optimizations
Fluid Storage for dynamic fork lifecycle
Production deployment (Vercel + Railway)
Technical Highlights
Clean Architecture Layers:
Domain (entities, interfaces, values)
β
UseCases (orchestrator, consensus, agents)
β
Infrastructure (MCP, Vertex AI, PostgreSQL)
β
Presentation (HTTP handlers, WebSocket)
Database Schema:
tasks - User-submitted queries
agent_executions - Agent activity logs
optimization_proposals - AI-generated solutions
benchmark_results - Performance metrics
consensus_decisions - Winning selections
Testing:
All Tiger Cloud interactions are production-ready:
Direct PostgreSQL connections to forks
Error handling for fork unavailability
Graceful degradation if MCP unreachable
Transaction safety in main DB
Conclusion
AgenticForkSquad demonstrates how Tiger Cloud's Agentic Postgres enables a new class of AI applications:
β
Multi-agent systems that need isolated testing environments
β
Parallel experimentation without storage penalties
β
Safe production updates via fork-test-apply workflow
β
MCP integration for programmatic database management
Tiger Cloud's zero-copy forks transformed database testing from a bottleneck into an enabler for AI collaboration.
Top comments (0)