> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Context Config • AI Agent SDK

> ContextConfig: Complete context management configuration.

# ContextConfig

> Defined in the [**models**](../modules/models) module.

<Badge color="blue">AI Agent</Badge>

Complete context management configuration.

Merges settings from CLI flags, env vars, and config files.

## Properties

<ResponseField name="auto_compact" type="bool">
  No description available.
</ResponseField>

<ResponseField name="compact_threshold" type="float">
  No description available.
</ResponseField>

<ResponseField name="strategy" type="OptimizerStrategy">
  No description available.
</ResponseField>

<ResponseField name="output_reserve" type="int">
  No description available.
</ResponseField>

<ResponseField name="history_ratio" type="float">
  No description available.
</ResponseField>

<ResponseField name="tool_output_max" type="int">
  No description available.
</ResponseField>

<ResponseField name="default_tool_output_max" type="int">
  No description available.
</ResponseField>

<ResponseField name="prune_after_tokens" type="int">
  No description available.
</ResponseField>

<ResponseField name="protected_tools" type="List">
  No description available.
</ResponseField>

<ResponseField name="tool_limits" type="Dict">
  No description available.
</ResponseField>

<ResponseField name="monitor" type="MonitorConfig">
  No description available.
</ResponseField>

<ResponseField name="keep_recent_turns" type="int">
  No description available.
</ResponseField>

<ResponseField name="llm_summarize" type="bool">
  No description available.
</ResponseField>

<ResponseField name="smart_tool_summarize" type="bool">
  No description available.
</ResponseField>

<ResponseField name="session_tracking" type="bool">
  No description available.
</ResponseField>

<ResponseField name="track_summary" type="bool">
  No description available.
</ResponseField>

<ResponseField name="track_goal" type="bool">
  No description available.
</ResponseField>

<ResponseField name="track_plan" type="bool">
  No description available.
</ResponseField>

<ResponseField name="track_progress" type="bool">
  No description available.
</ResponseField>

<ResponseField name="aggregate_memory" type="bool">
  No description available.
</ResponseField>

<ResponseField name="aggregate_sources" type="List">
  No description available.
</ResponseField>

<ResponseField name="aggregate_max_tokens" type="int">
  No description available.
</ResponseField>

<ResponseField name="compression_min_gain_pct" type="float">
  No description available.
</ResponseField>

<ResponseField name="compression_max_attempts" type="int">
  No description available.
</ResponseField>

<ResponseField name="tool_budgets" type="Dict">
  No description available.
</ResponseField>

<ResponseField name="tool_summarize_limits" type="Dict">
  No description available.
</ResponseField>

<ResponseField name="estimation_mode" type="str">
  No description available.
</ResponseField>

<ResponseField name="log_estimation_mismatch" type="bool">
  No description available.
</ResponseField>

<ResponseField name="mismatch_threshold_pct" type="float">
  No description available.
</ResponseField>

<ResponseField name="monitor_enabled" type="bool">
  No description available.
</ResponseField>

<ResponseField name="monitor_path" type="str">
  No description available.
</ResponseField>

<ResponseField name="monitor_format" type="str">
  No description available.
</ResponseField>

<ResponseField name="monitor_frequency" type="str">
  No description available.
</ResponseField>

<ResponseField name="monitor_write_mode" type="str">
  No description available.
</ResponseField>

<ResponseField name="redact_sensitive" type="bool">
  No description available.
</ResponseField>

<ResponseField name="snapshot_timing" type="str">
  No description available.
</ResponseField>

<ResponseField name="allow_absolute_paths" type="bool">
  No description available.
</ResponseField>

<ResponseField name="source" type="str">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="for_recipe()" icon="function" href="../functions/ContextConfig-for_recipe">
    Preset for recipe/workflow use cases with many tool calls.
  </Card>

  <Card title="from_env()" icon="function" href="../functions/ContextConfig-from_env">
    Load config from environment variables.
  </Card>

  <Card title="merge()" icon="function" href="../functions/ContextConfig-merge">
    Create new config with overrides applied.
  </Card>
</CardGroup>

<Accordion title="Internal & Generic Methods">
  * **to\_dict**: Convert to dictionary.
</Accordion>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Enable with defaults
    agent = Agent(instructions="...", context=True)
    
    # Custom configuration
    agent = Agent(
        instructions="...",
        context=ContextConfig(
            auto_compact=True,
            session_tracking=True,      # Track goal/plan/progress
            aggregate_memory=True,       # Concurrent multi-memory fetch
        )
    )
```

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/context/models.py#L246">
  `praisonaiagents/context/models.py` at line 246
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Context Concept" icon="layer-group" href="/docs/concepts/context" />

  <Card title="Context Management" icon="sliders" href="/docs/features/context-management" />

  <Card title="Context Strategies" icon="diagram-project" href="/docs/features/context-strategies" />

  <Card title="Configuration Overview" icon="gear" href="/docs/configuration/index" />

  <Card title="Agent Config" icon="robot" href="/docs/configuration/agent-config" />
</CardGroup>
