Summarizer Agent
The worker-only example in the set — no browser UI, just a topic consumer that enriches database rows.
Source: examples/summarizer-agent/
There is no model dependency. The summarizer is deterministic so the example is easy to read and the test is stable.
What it does
- A row lands in
blog.blogs - KalamDB routes the change into
blog.summarizer - The worker consumes the topic with
runConsumer() - The worker writes
summaryback into the same row - Failures are stored in
blog.summary_failures
Use change.data as the blog row inside onChange(). Because blog.blogs is a SHARED table, change.user is undefined in this example.
Prerequisites
- Node.js 18+
- Kalam CLI
Quick start
kalam dev starts the local server, applies kalam/schema.sql, keeps kalam/migrations/ current, and runs the worker with npm run start.
Schema and topic route
Worker pattern
Files worth reading
| File | Purpose |
|---|---|
src/agent.ts | Full worker logic |
kalam.toml | kalam dev project config |
kalam/schema.sql | Schema, topic route, and seed row |
kalam/migrations/0001_init.sql | Initial migration |
Verify it works
The integration test inserts a blog row and waits until the worker writes the summary field back.
Next steps
- Topic Consumer (Rust) — same pattern in Rust
- Chat With AI — topic worker plus browser UI
- TypeScript agents guide
Last updated on