Prompt Details
Model
(claude-5-5-sonnet)
Token size
4,012
Example input
[MULTI_AGENT_SYSTEM_ARCHITECTURE]: 3 agents: Research Agent β Analyst Agent β Report Agent.
[AGENT_ROLES_WORKFLOWS_AND_DEPENDENCIES]: Research Agent collects data. Analyst Agent verifies and analyzes it. Report Agent creates the final report.
[STATE_MEMORY_AND_SHARED_CONTEXT]: Shared database stores research results, analysis status, and report status.
[KNOWN_FAILURES_INCIDENTS_AND_RELIABILITY_PROBLEMS]: Research Agent sometimes times out after the web API returns no response.
[HUMAN_ESCALATION_AND_RELIABILITY_REQUIREMENTS]: Escalate if reliable recovery cannot be verified.
Example output
## ποΈ PHASE 1 β Reliability Context Reconstruction
### System Flow
**Research Agent**
β¬οΈ
**Web Search API**
β¬οΈ
**Research Result**
β¬οΈ
**Analyst Agent**
β¬οΈ
**Database State**
β¬οΈ
**Report Agent**
β¬οΈ
**Final Report**
### π Reliability Components
| Component | Reliability Concern |
|---|---|
| Research Agent | Agent timeout / incomplete execution |
| Web API | Timeout / unknown execution state |
| Analyst Agent | Invalid or incomplete research |
| Database | Stale or inconsistent state |
| Report Agent | Producing report from invalid analysis |
| Shared workflow | Failure propagation |
### β οΈ Important Distinction
The web API returning no response does **not automatically prove that the request failed**.
The system must distinguish:
**No Response β Confirmed Failure**
If the API request may already have succeeded, blindly retrying could create duplicate work or duplicate side effects.
---
# π₯ PHASE 2 β Failure Taxonomy Engine
| Failure | Category | Retryable? | Impact |
|---|---|---:|---|
| Research Agent crashes | Agent | Yes, conditionally | High |
| Web API timeout | Dependency | Yes, conditionally | Medium |
| Web API unknown execution status | Dependency | Not blindly | High |
| Invalid research output | Output | Yes | High |
| Analyst receives incomplete data | Workflow | Yes | High |
| Database stale state | State | No blind retry | High |
| Analyst/Research disagreement | Multi-Agent | No automatic retry | Medium |
| Report generated from invalid analysis | Workflow | No | High |
The framework specifically requires failures to be classified rather than treating everything as retryable. Pasted text
---
# π§ PHASE 3 β Failure Detection Architecture
### π Scenario: Web API Timeout
**Failure:**
Web API does not respond within the defined timeout.
**Detection Signal:**
Request timeout.
**Detection Point:**
Research Agent / API gateway.
**Detection Confidence:**
High that the response was not received.
**But:**
Low confidence regarding whether the external operation itself completed.
### Required Action
**Timeout**
β¬οΈ
**Check request/execution status**
β¬οΈ
**Determine known failure OR unknown execution**
β¬οΈ
**Choose retry/fallback/escalation**
The system should use schema validation, timeout detection, state validation, duplicate detection and workflow-progress checks where observable signals exist. Pasted text
---
# π§± PHASE 4 β Failure Containment & Fault Isolation
### Failure Scenario
Web API becomes unavailable.
### Bad Architecture
Web API Failure
β¬οΈ
Research Agent stuck
β¬οΈ
Analyst Agent waits
β¬οΈ
Report Agent waits
β¬οΈ
Entire workflow blocked β
### Better Architecture
Web API Failure
β¬οΈ
**Research Task Isolation**
β¬οΈ
Research task enters controlled failure state
β¬οΈ
Analyst is prevented from consuming incomplete research
β¬οΈ
Report Agent remains blocked safely
β¬οΈ
Recovery / Escalation
### π‘οΈ Containment Boundary
**Research task**
### π₯ Blast Radius
Potentially:
**Research β Analyst β Report**
### Safe Stopping Point
Before incomplete research is committed as valid research.
---
# β±οΈ PHASE 5 β Timeout & Stalled Workflow
### Test Case
Web API request:
**Start β Request β No Response**
System should execute:
**Timeout**
β¬οΈ
**Check State**
β¬οΈ
**Determine execution status**
β¬οΈ
**Retry / Fallback / Cancel / Escalate**
β¬οΈ
**Validate**
### Critical Rule
If the request has an unknown execution status:
β Do not immediately repeat a side-effecting operation.
Instead:
**Unknown Status**
β¬οΈ
**Check idempotency/request ID/status endpoint**
β¬οΈ
**Determine whether previous operation completed**
β¬οΈ
**Continue or retry safely**
This follows the framework's explicit distinction between no response and unknown execution status. Pasted text
---
# π PHASE 6 β Retry & Backoff Architecture
### Retry Policy
**Attempt 1**
β¬οΈ
Web API timeout
**Check execution status**
If confirmed transient failure:
β¬οΈ
**Retry 1**
If failure occurs again:
β¬οΈ
**Retry 2**
If still unsuccessful:
β¬οΈ
**STOP RETRYING**
β¬οΈ
**Escalate / fallback**
### π« Retry Protection
- Maximum attempts: **2**
- No unlimited retry
- No recursive retry
- No synchronized retry storm
- Retry only for defined transient failures
- Do not retry blindly when execution status is unknown
The supplied framework explicitly requires bounded retries and termination conditions. Pasted text
---
# π¦ PHASE 7 β Invalid Output & Contract Failure
Suppose Research Agent returns:
```text
Research completed successfully.
```
But required research fields are missing.
### Validation
**Schema**
β
**Required fields**
β
**Completeness**
β
**Task alignment**
β
Therefore:
**Output**
β¬οΈ
**Validation**
β¬οΈ
**Invalid**
β¬οΈ
**Reject Result**
Then choose:
**Retry Generation**
OR
**Request Correction**
OR
**Reassign Task**
The report agent must **not** treat the response as valid simply because it is syntactically readable. Pasted text
---
# π§ PHASE 8 β State Consistency & Corruption Recovery
### Example State
```text
Research Status: COMPLETED
Research Data: EMPTY
```
π¨ This is an inconsistent state.
### Detection
**State Invariant**
```text
If Research Status = COMPLETED
β Valid Research Data must exist
```
Invariant violation:
β¬οΈ
**Detect**
β¬οΈ
**Isolate State**
β¬οΈ
**Recover / Reconcile**
β¬οΈ
**Validate**
β¬οΈ
**Resume or Escalate**
The framework requires explicit handling of stale, partial, duplicated and conflicting state. Pasted text
---
# βοΈ PHASE 9 β Agent Disagreement Architecture
### Scenario
Research Agent:
> Source A indicates the market is growing.
Analyst Agent:
> Available evidence does not support that conclusion.
### β Bad Resolution
"Two agents agree, so use majority vote."
### β
Reliability Resolution
Agent A Result
+
Agent B Result
β¬οΈ
**Evidence Comparison**
β¬οΈ
**Conflict Classification**
β¬οΈ
**Additional Evidence**
β¬οΈ
**Validation**
β¬οΈ
**Final Decision**
If evidence remains unresolved:
β¬οΈ
**Human Escalation**
The framework specifically rejects arbitrary majority voting when evidence quality differs. Pasted text
---
# π PHASE 10 β Deadlock & Loop Prevention
### Potential Deadlock
Research Agent:
**"Waiting for Analyst validation."**
Analyst Agent:
**"Waiting for Research completion."**
Result:
**Research β Analyst**
π **Infinite wait**
### Detection
**No workflow progress**
β¬οΈ
**Dependency cycle detected**
β¬οΈ
**Identify participants**
β¬οΈ
**Break condition**
β¬οΈ
**Recover / Escalate**
### Required Limits
- Maximum retries
- Maximum delegation depth
- Execution deadline
- State-transition limit
- Explicit task ownership
- Termination condition
These controls directly align with the deadlock and loop-prevention requirements. Pasted text
---
# π PHASE 11 β Failure Propagation & Cascade Analysis
### Cascade Scenario
**Web API Timeout**
β¬οΈ
Research Agent fails
β¬οΈ
Research data unavailable
β¬οΈ
Analyst cannot verify
β¬οΈ
Analysis unavailable
β¬οΈ
Report Agent cannot produce trustworthy report
### Cascade Path
**Web API**
β **Research Agent**
β **Shared State**
β **Analyst Agent**
β **Report Agent**
β **Final Outcome**
### Containment Opportunity
Stop the cascade at:
**Research Agent β Shared State**
Do not allow incomplete research to become valid shared state.
The framework requires distinguishing possible propagation paths from observed propagation events. Pasted text
---
# β»οΈ PHASE 12 β Recovery Orchestration
### Recovery Table
| Failure | Recovery | Preconditions | Validation | Result |
|---|---|---|---|---|
| API timeout | Retry | Confirm transient | Valid response | Resume |
| API unknown status | Status check | Request ID available | Execution verified | Resume |
| Invalid research | Regenerate | Task still valid | Schema + content check | Resume |
| Corrupt state | Restore/reconcile | Recovery source exists | State invariant passes | Resume |
| Repeated failure | Escalate | Recovery exhausted | Human review | Stop |
Recovery must not create greater damage than the original failure. Pasted text
---
# π§© PHASE 13 β Partial Failure & Compensation
### Scenario
Web API successfully performs the operation.
But the response is lost.
System sees:
**"Timeout."**
However, the operation may actually have succeeded.
### Correct Flow
**Known Completed Work:** Unknown
β¬οΈ
**Unknown Work:** API execution status
β¬οΈ
**Remaining Work:** Research result retrieval
β¬οΈ
**Reconciliation**
β¬οΈ
**Validation**
### β Wrong
Simply call the API again.
### β
Correct
First determine whether the original operation completed.
The framework explicitly requires handling "tool executed but response was lost" and other partial-success situations. Pasted text
---
# π¨ PHASE 14 β Human Escalation Architecture
Escalation occurs when:
**Recovery Attempt 1**
β¬οΈ
Failure
**Recovery Attempt 2**
β¬οΈ
Failure
**Execution Status**
β Unknown
**State**
β Cannot verify
Therefore:
π¨ **Human Escalation**
### Escalation Package
**Task ID:** Research-1042
**Failure:** Web API timeout
**Current State:** Research execution status unknown
**Affected Components:** Research Agent, Analyst Agent
**Attempts:** 2
**Evidence:** API timeout logs / request ID
**Uncertainty:** External request may have completed
**Potential Impact:** Duplicate research or invalid downstream analysis
**Recommended Decision:** Verify external execution before retrying
**Resume Information:** Continue from research verification checkpoint
The framework requires escalation to include useful diagnostic context rather than simply saying "something failed." Pasted text
---
# π§ͺ PHASE 15 β Reliability Testing & Chaos Scenarios
## Test 1 β Agent Crash π₯
**Scenario:** Research Agent crashes during execution.
**Injected Failure:** Agent termination.
**Expected Detection:** Missing heartbeat / task expiration.
**Expected Recovery:** Restart task from checkpoint.
**Expected State:** No duplicate completed research.
**Validation:** Research state invariant passes.
**Escalation:** If checkpoint cannot establish a known-good state.
---
## Test 2 β API Timeout β±οΈ
**Scenario:** Web API does not respond.
**Injected Failure:** Timeout.
**Expected Detection:** Timeout signal.
**Expected Recovery:** Check execution status, then bounded retry if safe.
**Expected State:** No duplicate side effect.
**Validation:** Research result verified.
**Escalation:** Unknown execution status remains unresolved.
---
## Test 3 β Invalid Output π¦
**Scenario:** Research Agent returns incomplete data.
**Injected Failure:** Missing required fields.
**Expected Detection:** Schema/completeness validation.
**Expected Recovery:** Regenerate or reassign.
**Expected State:** Invalid result never becomes trusted state.
**Validation:** Required fields + task alignment.
---
## Test 4 β State Corruption π§
**Scenario:**
```text
Status = COMPLETED
Data = NULL
```
**Expected Detection:** State invariant violation.
**Expected Recovery:** Reconcile or restore.
**Expected State:** Consistent state.
**Escalation:** If no trusted recovery source exists.
---
## Test 5 β Deadlock π
**Scenario:** Research and Analyst wait for each other.
**Expected Detection:** No progress + dependency cycle.
**Expected Recovery:** Break cycle according to ownership/termination rules.
**Expected State:** Workflow terminated or safely resumed.
---
# π PHASE 16 β FINAL MULTI-AGENT RELIABILITY BLUEPRINT
## π 1. Reliability Executive Summary
The highest-risk scenario is the **ambiguous API timeout**.
The system cannot simply assume:
**Timeout = Failure**
because the external operation may have completed.
Therefore, the reliability architecture should prioritize:
**Execution-status verification β bounded retry β duplicate prevention β validation β controlled escalation**
---
## π 2. Failure Taxonomy
| Failure | Detectability | Retryable | Impact | Recovery |
|---|---|---|---|---|
| Agent crash | High | Yes | High | Restart |
| API timeout | High | Conditional | Medium/High | Verify + retry |
| Unknown execution | Medium | No blind retry | High | Reconcile |
| Invalid output | High | Yes | High | Regenerate |
| State corruption | Medium/High | No blind retry | High | Restore/reconcile |
| Deadlock | Medium | No | High | Break/escalate |
| Agent disagreement | High | No automatic retry | Medium | Evidence review |
---
# π 3. Failure Detection Architecture
**Failure**
β¬οΈ
**Detection Signal**
β¬οΈ
**Detection Point**
β¬οΈ
**Classification**
β¬οΈ
**Action**
Examples:
**Timeout β timeout signal β API boundary β transient/unknown β status check**
**Invalid output β schema violation β agent boundary β contract failure β regenerate**
**Deadlock β no progress β orchestration layer β dependency cycle β terminate/recover**
---
# π§± 4. Fault Containment Architecture
```text
WEB API
β
βΌ
RESEARCH AGENT
β
ββββββββ΄βββββββ
β β
Valid Invalid
β β
βΌ βΌ
STATE Isolate
β
βΌ
ANALYST AGENT
β
βΌ
VALIDATED ANALYSIS
β
βΌ
REPORT AGENT
```
Invalid research must be stopped before entering trusted shared state.
---
# β±οΈ 5. Timeout & Retry Policy
**Timeout**
β Check status
β Determine failure type
β Retry only if safe
β Maximum 2 attempts
β Validate
β Stop or escalate
No unlimited retry.
No blind repetition of potentially successful operations.
---
# π¦ 6. Invalid Output Handling
```text
Agent Output
β
Schema Check
β
Completeness Check
β
Task Alignment
β
Evidence Check
β
VALID ββββββ Continue
β
INVALID
β
Regenerate / Reassign / Reject
```
---
# π§ 7. State Consistency Architecture
Critical invariant:
**COMPLETED status requires valid corresponding data.**
If violated:
**Detect β Isolate β Reconcile β Validate β Resume/Stop**
---
# βοΈ 8. Agent Disagreement Resolution
```text
Agent A
+
Agent B
β
Evidence Comparison
β
Conflict Classification
β
Additional Evidence
β
Validation
β
Decision
β
Human Escalation if unresolved
```
---
# π 9. Deadlock Prevention
Monitor:
- Circular dependencies
- No-progress workflows
- Repeated state transitions
- Retry loops
- Delegation cycles
- Blocked queues
Every workflow requires a clear termination condition.
---
# π 10. Failure Propagation Map
**External API Failure**
β Research Agent
β Research State
β Analyst Agent
β Analysis State
β Report Agent
β Final Report
### Primary containment point:
**Research validation boundary**
---
# β»οΈ 11. Recovery Architecture
| Failure | Recovery | Validation | Final Action |
|---|---|---|---|
| Agent crash | Restart | Checkpoint validation | Resume |
| API timeout | Status check + safe retry | Response validation | Resume |
| Unknown execution | Reconcile | External status | Resume/stop |
| Invalid output | Regenerate | Contract validation | Resume |
| State corruption | Restore/reconcile | Invariant check | Resume/escalate |
| Deadlock | Break cycle | Progress validation | Resume/terminate |
---
# π§© 12. Partial Failure Strategy
For ambiguous execution:
**Do not repeat blindly.**
Instead:
**Identify known work**
β **Identify unknown work**
β **Reconcile**
β **Determine remaining work**
β **Validate**
β **Continue**
---
# π¨ 13. Human Escalation Framework
Escalate when:
- Recovery attempts are exhausted
- External execution is uncertain
- Critical state is corrupted
- Recovery cannot be verified
- Duplicate side effects could occur
- Deadlock cannot be safely broken
Human receives:
**Failure + State + Evidence + Attempts + Uncertainty + Impact + Recommended Decision**
---
# π§ͺ 14. Reliability Testing Plan
Minimum test suite:
1. Agent crash
2. API timeout
3. Unknown execution status
4. Invalid output
5. State corruption
6. Concurrent state update
7. Agent disagreement
8. Retry loop
9. Deadlock
10. Duplicate execution
11. Partial success
12. Recovery failure
13. Dependency outage
14. Human escalation
The framework explicitly requires failure injection and recovery validation rather than fabricated test results. Pasted text
---
# π 15. Reliability Observability
Track:
- Logs
- Metrics
- Traces
- Task lineage
- Retry counters
- Failure events
- Recovery events
- Escalation events
- State consistency events
This allows the system to answer:
**What failed?**
**Where did it fail?**
**Why did it fail?**
**What recovery was attempted?**
**Did recovery actually succeed?**
---
# π 16. FINAL RELIABILITY ENGINEERING BLUEPRINT
## π Core Control Loop
**FAILURE**
β¬οΈ
**DETECTION**
β¬οΈ
**CLASSIFICATION**
β¬οΈ
**CONTAINMENT**
β¬οΈ
**RECOVERY DECISION**
β¬οΈ
**RECOVERY**
β¬οΈ
**VALIDATION**
β¬οΈ
**CONTROLLED RESUMPTION**
If validation fails:
β¬οΈ
**STOP / COMPENSATE / ESCALATE**
### π― Final Verdict
For this test system, the **highest-priority reliability problem is not the timeout itself**.
It is the **uncertainty created by a timeout**.
The critical protection is:
**TIMEOUT β VERIFY EXECUTION STATUS β PREVENT DUPLICATION β RECOVER SAFELY β VALIDATE β RESUME OR ESCALATE**
That demonstrates the intended behavior of the Multi-Agent Reliability Architect: failures are not assumed to disappear; they are made **detectable, bounded, recoverable where appropriate, observable, and safely escalatable**. Pasted text
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-5-SONNET
Multi-Agent Reliability Architect is built specifically for engineering these failure conditions.
It analyzes the agent system's reliability surface and designs failure detection, containment, recovery, retry
- Agent failure
- Tool failure
- API timeout
- Invalid output
- State corruption
- Agent disagreement
- Retry loops
- Deadlocks
- Recovery
- Human escalation
Give the AI your multi-agent workflow and failure conditions, and turn them into a structured reliability and recovery architecture.
...more
Added 1 week ago
