Loading...
Loading...
Compare original and translation side by side
context-fundamentalscontext-degradationcontext-fundamentalscontext-degradation[Obs:{ref_id} elided. Key: {summary}. Full content retrievable.][Obs:{ref_id} 已省略。关键信息: {summary}。可检索完整内容。]| Context Composition | First Action | Second Action |
|---|---|---|
| Tool outputs dominate (>50%) | Observation masking | Compaction of remaining turns |
| Retrieved documents dominate | Summarization | Partitioning if docs are independent |
| Message history dominates | Compaction with selective preservation | Partitioning for new subtasks |
| Multiple components contribute | KV-cache optimization first, then layer masking + compaction | — |
| Near-limit with active debugging | Mask resolved tool outputs only — preserve error details | — |
| 上下文构成 | 首要操作 | 次要操作 |
|---|---|---|
| 工具输出占主导(>50%) | 观测掩码 | 对剩余轮次进行内容精简 |
| 检索到的文档占主导 | 总结 | 若文档独立则进行分区 |
| 消息历史占主导 | 选择性保留的内容精简 | 为新子任务进行分区 |
| 多个组件共同影响 | 先进行KV-cache优化,再叠加掩码+内容精简 | — |
| 接近限制且正在调试 | 仅掩码已解决的工具输出——保留错误细节 | — |
if context_tokens / context_limit > 0.8:
context = compact_context(context)if len(observation) > max_length:
ref_id = store_observation(observation)
return f"[Obs:{ref_id} elided. Key: {extract_key(observation)}]"undefinedif context_tokens / context_limit > 0.8:
context = compact_context(context)if len(observation) > max_length:
ref_id = store_observation(observation)
return f"[Obs:{ref_id} elided. Key: {extract_key(observation)}]"undefined
**Example 4: Budget-triggered optimization policy**
```yaml
budgets:
tool_outputs: 35%
message_history: 30%
retrieved_documents: 20%
reserved_buffer: 15%
triggers:
tool_outputs_over_budget: mask resolved observations
total_context_over_70_percent: compact message history
repeated_irrelevant_retrievals: tighten retrieval scope
**示例4:基于预算触发的优化策略**
```yaml
budgets:
tool_outputs: 35%
message_history: 30%
retrieved_documents: 20%
reserved_buffer: 15%
triggers:
tool_outputs_over_budget: mask resolved observations
total_context_over_70_percent: compact message history
repeated_irrelevant_retrievals: tighten retrieval scopeCurrent date: {today}Current date: {today}context-fundamentalscontext-degradationmulti-agent-patternsevaluationmemory-systemscontext-fundamentalscontext-degradationmulti-agent-patternsevaluationmemory-systems