Q&A: How does MeshResultAggregator handle slow or unresponsive agents? Quorum, timeout, and fallback #162
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.
Q: If one agent is slow or crashes mid-task, does
MeshResultAggregatorhang indefinitely?A: No — the aggregator uses a quorum + timeout model to avoid hanging.
How It Works
When
AgentMeshdispatches a task to N agents, the aggregator is told to expect N results. It does not require all N to respond — only a quorum (default: 50% of N).Crash vs. Slow
The aggregator does not distinguish between crashed and slow agents — both look like "no result received." The timeout is the only protection. If a task must complete in under 200ms (to fit inside a CognitiveCycle tick), set
timeout_ms=200.What Happens at Timeout?
QuorumNotReachedAggregationErrorThe CognitiveCycle should catch
QuorumNotReachedand either:What Happens to Late Results?
If an agent responds after the quorum was reached and aggregation is done,
receive_resultsilently discards the late result. The task entry is already gone from_collected.There is no mechanism to reopen a completed aggregation. If you need late results, set a higher quorum or longer timeout at dispatch time.
FIRST_DONE Strategy
For speculative execution tasks, use
AggregationStrategy.FIRST_DONE. The aggregator returns immediately when the first successful result arrives, without waiting for a quorum. Remaining results are discarded. This is ideal for cache lookups, where any agent with a cache hit wins.Relationship to AgentDiscovery
AgentDiscovery(#150) tracks per-agent health state (HEALTHY/DEGRADED/UNREACHABLE). You can pre-filter the dispatch list before callingwait_for_results:This avoids waiting for agents that are already known to be down.
Related
All reactions