Observed since 20 Oct, 21:42 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Context recovery for AI agents — analyze fatigue, compress context, improve token efficiency
Context recovery for AI agents. Analyze fatigue, compress context, improve token efficiency.
from agent_cop import analyze, recover
# Detect context bloat
report = analyze(messages)
# → { fatigue_score: 73, issues: [...], ... }
# Recover with algorithmic compression (free, no API key needed)
result = await recover(messages, budget_ratio=0.4)
# → { messages: [...], stats: { compression_ratio: "62.3%", ... } }
# Recover with LLM-based deep summarization (requires openai key)
result = await recover(messages, deep=True, openai_api_key="sk-...")
pip install agent-cop
For deep LLM summarization:
pip install "agent-cop[deep]"
analyze(messages)Detect context fatigue and bloat in a message history.
recover(messages, budget_ratio=0.5, deep=False, openai_api_key=None)Compress a message history to fit within a budget. Algorithmic by default (free). Pass deep=True with an OpenAI key for semantic LLM-based summarization.
from agent_cop.langchain import CopCallback
from langchain.agents import AgentExecutor
callback = SpaCallback(threshold=0.8)
agent = AgentExecutor(..., callbacks=[callback])
# Auto-recovers context at 80% token usage
curl -X POST https://api.agent-spa.dev/v1/recover \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{"messages": [...], "budget_ratio": 0.4, "deep": true}'
Generate a free API key at https://agent-cop.dev.
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 26 Jun 2026 | 1 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 21:42 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:df7724a17c1dcb2bb796d2f3330f801739fbad01cd9db629e209c2a2946e630c