bifrost-bridge
An event-sourced AI orchestration platform on Cloudflare Workers with multi-LLM routing, autonomous task execution, and bandit-based prompt optimization.
Overview
bifrost-bridge is an AI automation platform that orchestrates tasks across multiple LLM providers. It runs on Cloudflare Workers with an event-sourced architecture, managing everything from autonomous code generation to document processing.
Key Features
Multi-LLM Routing
The platform routes requests to the optimal LLM provider based on task type, cost constraints, and historical performance:
- Gemini (via Genkit) for structured data extraction and code generation
- DeepSeek for cost-effective reasoning tasks
- Claude for complex analysis and nuanced writing
- Perplexity for real-time research queries
Event Sourcing
Every state change is captured as an immutable event. This enables full audit trails, temporal queries, and the ability to replay task execution for debugging. The event store runs on Cloudflare Durable Objects.
Bandit-Based Prompt Optimization
Instead of manually tuning prompts, bifrost-bridge uses multi-armed bandit algorithms to evolve prompt variants. Each variant is scored on output quality, and the system automatically allocates more traffic to higher-performing prompts.
Attention Queue System
Tasks are prioritized using an attention queue that factors in urgency, dependencies, and resource availability. The system can operate autonomously within configurable policy boundaries or escalate decisions for human review.
Architecture Constraints
The project enforces strict development standards:
- One job per file — no monolithic service files
- JSDoc required on all exports
- Pre-push hooks validate code quality
- Event sourcing pattern for all state mutations
Tech Stack
- Runtime: Cloudflare Workers (V8 isolates, sub-10ms cold starts)
- Storage: Cloudflare KV, D1, R2, Durable Objects
- AI: Genkit, DeepSeek API, Anthropic API, Perplexity API
- Deployment: Wrangler CLI with GitHub Actions CI/CD
- Monitoring: Structured logging with Cloudflare Logpush