Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
When agents share state, one agent's mistakes, hallucinations, or half-formed reasoning can contaminate another's context — the second agent treats the first's speculation as fact. This compounds: errors propagate and amplify across the pipeline. Preventing contamination means marking the provenance and confidence of shared context (this is a verified fact vs. this is agent-2's hypothesis) so downstream agents weight it appropriately, and isolating speculative reasoning so it doesn't leak as ground truth. It's the multi-agent version of trust boundaries.
The demo tags every shared item with provenance and status (verified/hypothesis/raw) so a downstream agent can be instructed to act only on verified items and treat hypotheses as tentative — stopping error propagation.
When the model call fails. Read the error and decide: fix the request, retry, or fall back.
400/422(bad params, context-length exceeded),401/403(auth / no access to that model),404(wrong model id) are fatal — fix and don't retry.429,500/502/503, Anthropic529(overloaded), and timeouts are transient — retry with backoff. Watch for non-HTTP failures too:finish_reason: "length"truncation (raisemax_tokensor continue), safety refusals, malformed JSON / failed tool-call parsing (validate against a schema and repair-retry), and mid-stream disconnects. Always log the provider request id with the error so you can trace it later.
shared = [
{"text": "Q2 revenue was $4.1M", "by": "data-agent", "status": "verified"},
{"text": "Churn is probably seasonal", "by": "analyst-agent", "status": "hypothesis"},
]
def context_for_decider(shared):
lines = []
for item in shared:
tag = "[VERIFIED]" if item["status"] == "verified" else "[HYPOTHESIS — do not treat as fact]"
lines.append(f"{tag} {item['text']} (from {item['by']})")
return "\n".join(lines)
print(context_for_decider(shared))
# Decider is instructed: base conclusions only on [VERIFIED]; flag if relying on [HYPOTHESIS].python3 main.py