This guide demonstrates how to transform an AI-powered Marketplace Assistant into a production-ready multi-agent application using orra.
This updates the original guide implementation to leverage Cloudflare Agents and Durable objects. By combining Cloudflare's built-in durability with orra's Plan Engine, this approach provides a solid foundation for building reliable and scalable agent applications.
We'll explore how to build a marketplace assistant that helps users find and purchase products. This guide progressively improves the application by addressing common production challenges in multi-agent AI systems.
This guide is a compliment to the Wrangling Wild Agents talk by the orra team, presented at the AI in Production 2025 conference. We'll be using various sections of that talk in this guide.
This implementation uses Cloudflare's Workers and Durable Objects to build a robust, serverless architecture:
- Local Development: You can run everything locally using wrangler and miniflare. Each stage includes a setup script that configures the environment.
- Production Deployment: The same code can be deployed to Cloudflare's global network with minimal changes. You'll just need to update service URLs to point to your deployed Workers instead of localhost.
- Durable Objects: Stage 1 introduces a MarketplaceDataService using Durable Objects for state management, replacing the file-based storage from the original guide.
- The original AI Marketplace Agent implementation
- View implementation and details
- Build a distributed system with specialized agents and tools as services
- Integrate with orra for coordination, optimal performance, reduced costs and out of the box reliability
- Implement efficient communication between components with execution plans
- Uses Cloudflare Durable Objects for persistent data storage
- View implementation and details
- Add compensation handlers for critical operations
- Ensure system consistency during failures
- Implement automatic recovery mechanisms
- View implementation and details
- Ground all jobs and actions in your intended domain only
- Define use cases with clear capability patterns
- Prevent hallucinated plans and invalid actions - before plans are executed
- View implementation and details
Each component demonstrates orra's capabilities:
- Product Advisor Agent: LLM-powered product recommendation engine
- Inventory Service: Simulated inventory database with holds and releases
- Delivery Agent: Estimates delivery times based on various factors
- Purchasing Service: A product purchasing that creates orders, makes payments with occasional failures and notifies users
- Marketplace Data Service: Durable Object-based data store for products, users, and orders
- Make sure you have Node.js installed (v18 or later)
- Clone this repository
- Follow the orra's installation instructions
- Follow the instructions in each stage's README.md file
- Run the provided scripts in each stage to see the improvements in action
User: "I need a used laptop for college that is powerful enough for programming, under $800."
System:
- Product Advisor Agent analyzes request, understands parameters
- Inventory Service checks available options
- Product Advisor Agent recommends: "I found a Dell XPS 13 (2022) with 16GB RAM, 512GB SSD for $750."
User: "That sounds good. Can I get it delivered by next week?"
System:
- Delivery Agent calculates real-time delivery options
- "Yes, it can be delivered by Thursday. Would you like to proceed with purchase?"
User: "Yes, let's do it."
System:
- Orchestrates parallel execution:
- Inventory Service places hold on laptop
- Delivery Agent provides delivery estimate
- Purchasing service places order and notifies user
Each stage builds upon the previous one and includes:
- A dedicated folder with complete code
- A detailed README explaining:
- The problem being addressed
- The solution implemented with orra
- Key benefits and improvements
- Architecture diagrams and examples
- Runnable code to demonstrate each concept
- Multi-agent systems require careful orchestration
- Production-ready AI applications need reliable transaction handling
- Domain grounding prevents hallucinated plans and actions
- An audit trail is essential for system reliability
- orra provides a comprehensive platform for building robust AI applications
- Cloudflare Workers and Durable Objects offer a scalable, serverless foundation for AI systems
Discuss on Hacker News