Building a Durable Message Queue on SQLite for AI Agent Orchestration
I'm building a local AI agent orchestration tool. Multiple agents run asynchronously — user messages come in, executors return results, approvals fire callbacks. All of these are events, and they n...

Source: DEV Community
I'm building a local AI agent orchestration tool. Multiple agents run asynchronously — user messages come in, executors return results, approvals fire callbacks. All of these are events, and they need to flow reliably through the system. The key word is reliably. An agent crashes mid-task. The process gets killed. The machine restarts. When things come back up, pending events must still be there, ready to retry. Losing an event means losing work. So I needed a durable message queue. But here's the constraint: this is a local developer tool, not a cloud service. Users install it with npm install and it should just work. Requiring them to run Redis or RabbitMQ — or any external process — is a non-starter. SQLite was already in the stack for persistent storage — and it has strong transactional guarantees. Could it also be the queue? Why not just a "jobs" table? The first instinct is to create a table with a status column and poll it: SELECT * FROM jobs WHERE status = 'pending' ORDER BY cr