Skip to content

Cookbook

Practical recipes demonstrating common patterns with OpenAgentMesh. Each recipe is a self-contained code sample you can copy and run.

To run any recipe against a local embedded mesh:

import asyncio
from openagentmesh import AgentMesh

async def run():
    async with AgentMesh.local() as mesh:
        # paste the recipe's main() body here
        ...

asyncio.run(run())

Or against your own mesh started with oam mesh up:

async with AgentMesh() as mesh:     # connects to nats://localhost:4222
    ...

Available Recipes

Recipe Pattern
Multi-Process Agents Provider/consumer on a shared bus
Multi-Module Projects Scaling beyond a single file
Shared Plan Coordination CAS-based concurrent state
LLM-Driven Tool Selection Runtime discovery for LLM tools
Error Handling Retry, fallback, monitoring
Automatic Load Balancing Queue group scaling
Reactive Pipeline KV watch coordination
Parallel RAG Indexing ObjectStore + queue groups

Interactive demos

For an interactive experience, try oam demo. It starts a local mesh with sample agents you can explore from another terminal.