Examples
Complete, runnable examples demonstrating Helix Agents patterns and features.
Choosing an Example
Use this decision matrix to find the right starting point:
| If you need... | Start with |
|---|---|
| Learn the basics | Research Assistant |
| Durable workflows | Research Assistant (Temporal) |
| Edge deployment (simple) | Research Assistant (Cloudflare) |
| Edge + unlimited streaming | Research Assistant (Cloudflare DO) |
| Full-stack with SSR | Resumable Streams (Next.js) |
| Production edge + Next.js | OpenNext + Cloudflare DO |
| Custom execution logic | Custom Loop |
Feature Comparison
| Example | Runtime | Frontend | Persistence | Resumable | SSR |
|---|---|---|---|---|---|
| Research Assistant | JS | None | Memory | No | No |
| Research Assistant (Temporal) | Temporal | None | External | Yes | No |
| Research Assistant (Cloudflare) | Workflows | None | D1 | Yes | No |
| Research Assistant (Cloudflare DO) | DO | None | SQLite | Yes | No |
| Resumable Streams (Next.js) | JS | Next.js | Redis | Yes | Yes |
| OpenNext + Cloudflare DO | DO | Next.js | SQLite | Yes | Yes |
| Custom Loop | Custom | None | None | Custom | No |
When to Use Each Runtime
JS Runtime (runtime-js):
- Local development and testing
- Single-process applications
- Serverless functions with short execution
Temporal Runtime (runtime-temporal):
- Long-running workflows (hours/days)
- Complex retry and compensation logic
- Existing Temporal infrastructure
Cloudflare Workflows (runtime-cloudflare):
- Edge deployment with durability
- Executions under 15 minutes
- D1 database integration
Cloudflare Durable Objects (store-cloudflare with AgentServer):
- Unlimited execution time
- Real-time streaming requirements
- SSE-based resumable streams
- Direct WebSocket-like patterns
Quick Start Examples
| Example | Runtime | Description |
|---|---|---|
| Research Assistant | JS | Basic agent with tools, state, and streaming |
| Research Assistant (Temporal) | Temporal | Same agent with durable execution |
| Research Assistant (Cloudflare) | Cloudflare | Edge deployment with D1 and Workflows |
| Research Assistant (Cloudflare DO) | Cloudflare DO | AgentServer extensibility, lifecycle hooks |
Advanced Examples
| Example | Description |
|---|---|
| Custom Loop | Build your own execution loop without runtime helpers |
| Resumable Streams (Next.js) | SSR, stream resumption, crash recovery with React hooks |
| OpenNext + Cloudflare DO | Full-stack Next.js on Cloudflare with DO streaming |
By Feature
State Management
- Research Assistant - Custom state schema, state mutations in tools
Sub-Agents
- Research Assistant - Summarizer sub-agent delegation
Streaming
- Research Assistant - Real-time streaming with custom events
Durable Execution
- Research Assistant (Temporal) - Crash recovery, checkpointing
- Research Assistant (Cloudflare) - Edge-native durability
- Research Assistant (Cloudflare DO) - DO-based checkpoint recovery
AgentServer Extensibility
- Research Assistant (Cloudflare DO) - Lifecycle hooks, custom LLM adapters, multi-agent support
Stream Resumption & Crash Recovery
- Resumable Streams (Next.js) - SSR, useAutoResync hook, snapshot pattern
- OpenNext + Cloudflare DO - Production edge deployment with SSR
Running Examples
All examples are in the examples/ directory of the monorepo:
bash
# Clone and setup
git clone https://github.com/your-org/helix-agents.git
cd helix-agents
npm install
npm run build
# Run JS example
cd examples/research-assistant
npm test # Run tests (no API key needed)
OPENAI_API_KEY=sk-xxx npm run demo # Run with real LLMSee each example's README for specific setup instructions.