Q&A: How does AgentMesh handle agent failures and crashed tasks? #153
Unanswered
web3guru888
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Question
I'm looking at the AgentMesh design in #147 and wondering: what happens when an agent dies mid-task?
For example:
PLANNER:001PLANNER:001writes the task to its Blackboard namespace and starts processingHow does the coordinator detect and recover from this?
Short Answer
Three failure detection and recovery mechanisms work together:
1. Heartbeat timeout — AgentStatus.UNREACHABLE
The
AgentDiscoveryservice registry (#150) runs a backgroundhealth_sweep()every 5 seconds. If an agent misses heartbeats for > 30 seconds, it transitions:The coordinator immediately stops dispatching to UNREACHABLE agents.
2. Task TTL expiry
Every
mesh.task.assignedentry written to the Blackboard has a TTL (default 60s). When the entry expires, the coordinator's task-result listener detects a timeout and re-dispatches:3. Agent self-reported failure
Well-behaved agents that encounter unrecoverable errors write a failure result to the Blackboard before exiting:
Failure Scenario Walkthrough
What About In-Flight State?
If
PLANNER:001was halfway through decomposing a complex goal, that partial state is lost on crash. Two mitigation strategies:Checkpoint pattern: agents write incremental results to the Blackboard as they go (not just the final result). On retry, the new agent reads partial state and continues.
Idempotent tasks: design task payloads so re-running from scratch produces the same result. Works well for pure-function tasks (e.g. graph pathfinding) but not for stateful operations (e.g. KG writes already committed).
Both patterns are analogous to the CognitiveCycle resilience design — see #134 and #139 for the retry budget patterns used there.
Open Question
Should the coordinator maintain a persistent task log (SQLite or append-only file) so that in-flight tasks survive coordinator restarts? Or is the Blackboard TTL + agent heartbeat sufficient for the current research phase?
Related: #147 (AgentMesh), #150 (AgentDiscovery), #139 (retry budget patterns)
All reactions