r/LangChain
Self-hosting LangGraph/Deep Agents: how do you handle worker ownership and crash recovery?
- upvotes
- 15
- comments
- 38
Post
I’m building a Python/FastAPI application with LangGraph/Deep Agents and PostgreSQL. I’m running my own background workers instead of using Agent Server. How do you handle: Exclusive execution for a conversation across multiple workers? Leases and heartbeats to detect failed workers? Recovery when a lease expires but the old worker is still alive? Preventing that old worker from saving checkpoints after another worker takes over? Cancellation and graceful shutdown without losing accepted work? The difficult case seems to be distinguishing a dead worker from a slow or disconnected worker. A lease alone doesn’t prevent stale checkpoint writes. Are there open-source frameworks that provide these guarantees out of the box, preferably with LangGraph integration? Or do most teams build this coordination themselves? I’d appreciate examples from production systems, including failure cases you encountered.
Extracted from these lines
[comment u/Candid-Fudge-4015] On frameworks, the closest thing to these guarantees out of the box is a durable execution engine. Temporal gives you one running workflow per ID, activity heartbeats with timeouts, and cancellation, and it rejects results from a worker whose task already timed out, so the zombie case is handled for you.
[comment u/Adventurous-Bat-3174] A documented option is temporalio-langgraph, currently in public preview. Its checkpointer guide uses InMemorySaver when needed because Temporal owns execution durability.