Context management is opt-in via the
context= parameter. When disabled (default), there is zero performance overhead.Quick Start
1
Enable with defaults
2
Fine-tune strategy and threshold
Default Behavior
Interactive Mode (praisonai chat)
To enable in CLI:
Auto-Agents Mode (Agents)
To enable:
Optimization Strategies
Strategy Overview
When to Use Each
truncate: Simple chatbots, Q&A agentssliding_window: Long conversations where recent context matters mostprune_tools: Tool-heavy agents with large outputssummarize: When historical context is criticalconversation: Multi-hour planning sessions, iterative development — automatically falls back tosmartwhen compaction ratio isn’t meaningful, making it safe as a default for long-running agentssmart(recommended): Production use, balances all concerns
Overflow Handling
Threshold Playbook
Automatic Handling
Whenauto_compact=True, the system automatically:
- Monitors token usage before each API call
- Triggers optimization when threshold is reached
- Applies the configured strategy
- Logs the optimization event
Budgeting
Token Allocation
The context budget is divided into segments:Custom Budgets
Monitoring
Enable Context Monitoring
Snapshot Output Example
Percentage Display
Context utilization is displayed with smart formatting:- Values
< 0.1%: Shows<0.1% - Values
< 1%: Shows 2 decimal places (e.g.,0.02%) - Values
>= 1%: Shows 1 decimal place (e.g.,5.3%)
Multi-Agent Policies
Isolated (Default)
Each agent has its own context ledger:Shared
Agents share a common context ledger:Redaction & Security
Sensitive data is automatically redacted in snapshots:- API keys (OpenAI, Anthropic, Google, AWS, etc.)
- Passwords and secrets
- Email addresses (optional)
- Custom patterns
Configuration Reference
ManagerConfig Options
How It Works
Best Practices
Pick strategy by session length
Pick strategy by session length
Short chats can use
truncate; long support threads benefit from smart or LLM summarisation.Isolate multi-agent context
Isolate multi-agent context
Use
policy="isolated" unless agents explicitly share a workspace.Leave redaction on
Leave redaction on
redact_sensitive=True protects API keys in tool results from appearing in logs.Revisit strategy after model changes
Revisit strategy after model changes
A larger context window may let you switch to lighter strategies and save latency.
Related
Context Budgeter
Token budget allocation
Context Monitor
Real-time context snapshots
Context Optimizer
Reduce context when over budget
Fast Context
High-performance context handling

