Example applications for Zeitlich – durable AI agents for Temporal.
- Node.js >= 18
- Temporal server (local dev:
temporal server start-dev) - Redis
npm installCreate a .env file with your API key and optionally override Temporal/Redis settings:
ANTHROPIC_API_KEY=sk-...
# TEMPORAL_ADDRESS=localhost:7233
# REDIS_HOST=localhost
# REDIS_PORT=6379-
Start Temporal (if not already running):
npm run dev:temporal
-
Start the worker (in another terminal):
npm run worker:multi-agent
-
Trigger a workflow (in another terminal):
npm run start:multi-agent
| Script | Description |
|---|---|
dev:temporal |
Start Temporal dev server |
worker:multi-agent |
Run the multi-agent worker (watch) |
start:multi-agent |
Start the multi-agent workflow |
typecheck |
Run TypeScript check |
lint / lint:fix |
ESLint |
format / format:check |
Prettier |
A multi-agent debate system with a main orchestrator ("Herr Zeitlich") and two subagent philosophers (Nietzsche and Ayn Rand). Demonstrates tools, subagent delegation, state management, and in-memory filesystem access.
src/examples/multi-agent/
├── workflows.ts # Re-exports all workflows
├── worker.ts # Registers workflows/activities with ZeitlichPlugin
├── start.ts # Client script to trigger the workflow
└── agent/
├── workflow.ts # Main orchestrator workflow
├── activities.ts # LLM invocation + tool handler factories
├── config.ts # Agent name, system prompt, maxTurns
├── data.ts # In-memory filesystem (invoices, clients, etc.)
└── subagents/
├── nietzsche/
│ ├── workflow.ts # Subagent workflow (returns string | null)
│ ├── activities.ts # Subagent LLM invocation
│ └── config.ts # Subagent personality & description
└── ayn-rand/
├── workflow.ts
├── activities.ts
└── config.ts
Key patterns demonstrated:
defineTool()with per-toolhooksfor state updatesproxyDefaultThreadOps()for Redis-backed thread persistencecreateSession()withsubagents,buildContextMessage, andsystemPromptinvokeModel()with{ config, model, redis, client }signaturecreateBashHandler()/createAskUserQuestionHandler()factory patterntoTree()with an in-memory filesystem object
The app uses the published zeitlich package; workflow code imports from zeitlich/workflow, activities and worker from zeitlich.
MIT