Agents Shouldn't Pass Context. They Should Share Memory
说明与用途
多代理链经常导致上下文膨胀,增加成本和延迟。解决方案是使用共享内存架构,包含三个层次(情节、语义、程序)并采用基于令牌预算的检索,保持提示大小固定,成本可预测。
问题
Multi‑agent chains accumulate token‑heavy context, driving up cost, latency, and diluting attention.
结果
Token consumption per round became a fixed budget, eliminating linear growth; cost and latency stabilized across long chains and multi‑session use.
工作流
- 1. Agent writes output to an append‑only episodic log (L1).
- 2. Asynchronously project new log entries into the semantic tier (L2) via LLM extraction.
- 3. Agent retrieves a token‑budgeted slice from both L1 (fresh events) and L2 (distilled facts).
- 4. Agent performs its task and appends its result to L1.
- 5. Repeat for each agent in the chain; on new sessions, L2 provides cross‑session beliefs.
- 6. Periodically rebuild L2/L3 from L1 if needed for consistency.
证据
Agents do not hand anything to each other directly. Each agent writes its output to a shared memory layer, and the next agent retrieves only the slice it needs, capped to a token budget.
The episodic tier (L1) is an append‑only log of everything that happens in a session…
If Agent A produced forty thousand tokens of investigation and Agent B needs the three thousand tokens of conclusion, B receives three thousand.
- 记录日期: 2026-09-09T02:15:22.700Z