Skip to content

Unbounded per-agent memory causes long-run degradation and collapse #56

Description

@Quantum-eon

Summary

Agent memory/context appears to grow without bound over rounds. On long runs we observed request context grow from ~167k to ~445k tokens, at which point the run enters a cascade of provider 400 (context-length) and 429 errors and effectively collapses. The onset scales with agent count: more agents → earlier collapse. A sliding-window or summarization scheme for agent memory would make long runs viable.

Reproduction

  1. Configure a long run (the easiest way, until Issue Proposed changes for fresh builds #2 is fixed, is a long prompt horizon → thousands of rounds) with ~7 agents.
  2. Let it run; monitor per-request token counts and provider errors.
  3. Around round ~300 (at 7 agents), requests approach provider context limits and 400/429 errors begin cascading; per-round wall time also degrades sharply in the tail (multi-minute twitter/reddit rounds).

Observed

  • Context growth from ~167k to ~445k tokens over a long run, then cascading 400/429 failures.
  • Degradation threshold tracks agent count, not model family:
    • ~round 300 with 7 agents;
    • ~round 515 with 4 agents;
    • clean, error-free 168-round runs at 10–11 agents (Claude Sonnet 4 and Gemini 2.5 Flash);
    • 18–19-agent runs needed a controlled stop well before their round target, with severe tail slowdown.
  • So the practical round ceiling is a function of (agents × rounds), and nothing warns the user where that ceiling is.

Expected

Agent context should stay bounded regardless of round count, so that run length is limited by budget/intent rather than by silent context exhaustion.

Suggested fix

  • Bound per-agent memory: sliding window over recent rounds plus periodic LLM summarization of older memory (or importance-weighted retrieval), so per-round prompt size plateaus.
  • Fail loudly and early when a request approaches the provider's context limit (log + surface in UI) instead of entering a retry cascade.
  • Optionally, document a supported envelope (agents × rounds) until memory is bounded.

Context / disclosure: We are an independent research team auditing multi-agent simulation pipelines. We found this while running a systematic 18-run study on MiroFish-Offline across four LLM families. We plan to publish a reproducible study referencing this issue in roughly 4 weeks, and we're happy to share drafts with maintainers beforehand. Thank you for open-sourcing this project — it made this kind of research possible in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions