Inspiration
We run a small team of AI agents on a real project. One agent plans from a laptop, another executes on a Mac across the room, a third reviews. They kept losing work the same way: state lived inside one process, and when the process died, the work died with it. We wanted crash recovery built into the system itself so every agent gets it for free. Work state is already a graph: tasks block tasks, agents claim tasks, events happen to tasks. So we put the team's state in one embedded Relate database that every agent shares. Then we used it to run the project it was built on.
What it does
WorkGraph keeps a team's tasks, dependencies, lease claims, heartbeats and event log in one embedded Relate store. No server, no service to run. Any agent process opens the same store, claims work whose dependencies are done, and completes it. When an agent stops heartbeating, its lease expires and its claimed tasks go back on the board for a teammate. Graph queries cover critical_path, blocked_by, blast_radius and lineage. A small web board shows the live graph and the event stream.
How we built it
Python on the relate-db binding. One WorkGraph class wraps the Cypher queries for claims, heartbeats, leases and recovery. Claims are atomic at the graph level, so two agents never take the same task, and a dead agent's claim expires on its own. The CLI drives everything the board does. The board is only the Python standard library: http.server serving a canvas page that polls a snapshot endpoint. The demo runs real subprocess workers, not threads pretending to be agents.
Challenges
The recovery query first matched any CLAIMED edge from a dead agent, including edges left over after a task was requeued and reclaimed. The task bounced between open and claimed forever. The fix was to match only the current claimant's edge and delete stale claim edges on recovery. Real subprocesses forced the second big change: a slow task looks exactly like a dead agent unless the claim carries an expiry the worker renews. That is where the lease design came from.
Accomplishments
Kill -9 a worker mid-task and watch its work come back on another worker. That works end to end with real OS processes. demo2.py proves it: it starts a worker subprocess, kills it with SIGKILL mid-task, and a second worker recovers the claim and finishes the task. 22 tests pass on macOS and Linux. And the loop closed: WorkGraph coordinated its own build. Our mission store tracks daily work between agents on two machines, market notes, a README review, a 368-file verification pass, each with full lineage.
What we learned
Embedded graph databases turn multi-agent coordination into a local problem. A lease beats a lock when workers can die. Thread-affine connections shaped the board: the page never touches the database, agents hand snapshots over.
What's next
A retention policy on the event log, the board packaged as a standalone observer for any WorkGraph store, and more queries as the dogfood run asks for them.
Product capabilities used
The embedded Relate store through the relate-db Python binding, with Cypher queries over tasks, dependencies, claims, heartbeats and events. Third-party tools: none beyond relate-db and the Python standard library.
AI use
Built with AI pair-programming (design iteration, code drafting and debugging), as the rules allow.
Built With
- python
- relate