P
PSBigBig
Guest
Symptom
when multiple AI agents query the same PDF or vector database at the same time, instead of collaboration you get semantic contamination. answers drift, citations donβt match, and retrieval coverage mutates depending on which agent touched the index first.
Common Failure Patterns in Multi-Agent Pipelines
- Two agents ingest the same document concurrently β their traces overwrite each other.
- Retrieval results differ depending on run order, even with identical queries.
- Citations point to spans that only one agent saw, the other invents filler.
- Embedding counts mismatch corpus size because each agent tokenized differently.
- Logs show answers that change unpredictably across sessions, leading to βghost context.β
These are classic multi-agent concurrency bugs in retrieval-augmented generation (RAG) systems.
ProblemMap Reference
- No.13 Multi-agent chaos This failure mode happens when pipelines allow parallel agents on shared resources (vector stores, indexes, traces) without isolation. Instead of independent reasoning, they pollute each otherβs context.
Quick 60-second Diagnostic
Isolation probe
Run two agents on the same PDF. If traces merge or overwrite, contamination confirmed.
Index collision
Let agents build embeddings in parallel. If token counts differ or coverage jumps, vectorstore not isolated.
Cross-contamination test
Ask Agent A about fact X, then Agent B about fact Y. If Bβs answer contains Aβs context, pipeline leaked.
Checklist for Diagnosis
- Interleaved ingestion logs (no separation between agents)
- Retrieval results fluctuate even when corpus is stable
- Hallucinations correlate with concurrency, not corpus difficulty
- Embedding stats mismatch expected document size
- Trace logs lack per-agent identifiers
Minimal Fixes
The immediate goal is to enforce single-source trace and index isolation.
- Separate traces per agent β each run must log independently.
- Isolate index access β agents use read-only mode or build local caches.
- Lock ingestion β no simultaneous writes on the same document.
- Explicit agent IDs β tag all chunks with the originating agent.
Hard Fixes for Production
- Multi-tenant vectorstore partitions (per agent / per task)
- Ingestion validators to reject mixed-agent writes
- Evaluation gates (coverage β₯ 0.7 before allowing merge)
- A coordination/orchestration layer to serialize agent requests
These are necessary for scalable multi-agent frameworks where concurrency is unavoidable.
Guardrails from WFGY
- Trace isolation β per-agent semantic tree logging
- Index fences β embedding contracts per agent before merging
- Retrieval playbook β enforce consistency across paraphrases before sharing results
- Audit logs β intake β embedding β retrieval per agent, visible in traces
This shifts the failure from βsilent contaminationβ to an observable, debuggable process.
Tiny Sanity Script
Code:
class Agent:
def __init__(self, name):
self.name = name
self.trace = []
def ingest(self, doc):
self.trace.append(f"{self.name} saw {doc}")
A = Agent("A")
B = Agent("B")
A.ingest("PDF1")
B.ingest("PDF1")
print(A.trace) # ['A saw PDF1']
print(B.trace) # ['B saw PDF1']
# independent traces β no cross-contamination
Acceptance Checks
- Each agentβs trace log reproducible and independent
- Retrieval coverage stable across concurrent runs
- No hallucinations tied to query order or concurrency
- Merges only allowed after validation per agent
TL;DR
Multi-agent chaos happens when multiple agents share the same intake or index without proper isolation. Always enforce per-agent fences before merging. Otherwise, your RAG pipeline ends up with semantic contamination and unpredictable drift. Call it ProblemMap No.13.


Continue reading...