Adding background workers to my agent
An example build note about separating task acceptance from task execution.
The idea
Long-running agent work should not depend on keeping a web request alive. A small background worker is a useful place to begin exploring that boundary.
This is a starter example for a future build log, not a claim that this system has already been built.
The smallest useful flow
- Accept a task and persist it.
- Return a task ID to the caller.
- Let a worker claim and execute the task.
- Store the result so the caller can check its status.
What to capture in a real build log
Show the task lifecycle, a trace of one execution, and how the UI learns that the task finished. Include a link to the code and an honest account of what remains unreliable.
The next question
What happens when a worker disappears after claiming a task? That question leads directly into leases, timeouts, and retry behavior.