mirror of
https://github.com/open-multi-agent/open-multi-agent.git
synced 2026-10-19 01:31:07 -05:00
- Tighten positioning, lift demo, sharpen comparison table. - Refresh temodar star count, drop dead link. - Fold tool/memory/context sections into docs/. - Swap npm downloads badge for GitHub forks. - Correct custom context strategy signature and Copilot env var (README, README_zh, docs/context-management.md). - Inline agent definitions so quick-start snippet is self-contained. - Move CONTRIBUTING/CODE_OF_CONDUCT/SECURITY/codecov to .github/, DECISIONS.md to docs/. - Fix CONTRIBUTING README link after the .github/ move. - Ignore local .claude/ config dir.
1.1 KiB
1.1 KiB
Context Management
Long-running agents can hit input token ceilings fast. Set contextStrategy on AgentConfig to control how the conversation shrinks as it grows:
const agent: AgentConfig = {
name: 'long-runner',
model: 'claude-sonnet-4-6',
// Pick one:
contextStrategy: { type: 'sliding-window', maxTurns: 20 },
// contextStrategy: { type: 'summarize', maxTokens: 80_000, summaryModel: 'claude-haiku-4-5' },
// contextStrategy: { type: 'compact', maxTokens: 100_000, preserveRecentTurns: 4 },
// contextStrategy: { type: 'custom', compress: (messages, estimatedTokens) => ... },
}
| Strategy | When to reach for it |
|---|---|
sliding-window |
Cheapest. Keep the last N turns, drop the rest. |
summarize |
Send old turns to a summary model; keep the summary in place of the originals. |
compact |
Rule-based: truncate large assistant text blocks and tool results, keep recent turns intact. No extra LLM call. |
custom |
Supply your own compress(messages, estimatedTokens) function. |
Pairs well with compressToolResults and maxToolOutputChars.