> ## 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.

# Config Module

> Feature configuration classes for agent-centric API

# Module praisonaiagents.config

The `config` module provides dataclass-based configuration for all agent features. These classes offer type safety, sensible defaults, and IDE autocompletion.

## Quick Start

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import (
    MemoryConfig,
    OutputConfig,
    ExecutionConfig,
    PlanningConfig,
)
```

Or use the namespace style:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import praisonaiagents as pa

config = pa.config.MemoryConfig(user_id="user123")
```

## Configuration Classes

<CardGroup cols={2}>
  <Card title="MemoryConfig" icon="brain" href="#memoryconfig">
    Memory and session management
  </Card>

  <Card title="KnowledgeConfig" icon="book" href="#knowledgeconfig">
    RAG and knowledge retrieval
  </Card>

  <Card title="OutputConfig" icon="display" href="#outputconfig">
    Output formatting and verbosity
  </Card>

  <Card title="ExecutionConfig" icon="gear" href="#executionconfig">
    Agent execution parameters
  </Card>
</CardGroup>

<CardGroup cols={2}>
  <Card title="PlanningConfig" icon="clipboard-list" href="#planningconfig">
    Planning mode settings
  </Card>

  <Card title="ReflectionConfig" icon="lightbulb" href="#reflectionconfig">
    Self-reflection settings
  </Card>

  <Card title="GuardrailConfig" icon="shield" href="#guardrailconfig">
    Safety and validation
  </Card>

  <Card title="WebConfig" icon="globe" href="#webconfig">
    Web search configuration
  </Card>
</CardGroup>

***

## MemoryConfig

Configuration for agent memory and session management.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import MemoryConfig, MemoryBackend

# Simple usage
config = MemoryConfig(user_id="user123", session_id="session456")

# With backend selection
config = MemoryConfig(
    backend=MemoryBackend.SQLITE,
    user_id="user123",
    session_id="session456",
)

# Usage in Agent
from praisonaiagents import Agent
agent = Agent(
    instructions="...",
    memory=config,
)
```

### Parameters

| Parameter       | Type            | Default | Description                                                    |
| --------------- | --------------- | ------- | -------------------------------------------------------------- |
| `backend`       | `MemoryBackend` | `FILE`  | Storage backend (FILE, SQLITE, REDIS, POSTGRES, MEM0, MONGODB) |
| `user_id`       | `str`           | `None`  | User identifier for memory isolation                           |
| `session_id`    | `str`           | `None`  | Session identifier                                             |
| `auto_memory`   | `bool`          | `False` | Enable automatic memory extraction                             |
| `claude_memory` | `bool`          | `False` | Use Claude memory format                                       |
| `learn`         | `LearnConfig`   | `None`  | Continuous learning configuration                              |

***

## OutputConfig

Configuration for output formatting and verbosity.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import OutputConfig

# Verbose output with markdown
config = OutputConfig(
    output="verbose",
    markdown=True,
    show_reasoning=True,
)

# Using presets (simpler)
from praisonaiagents import Agent
agent = Agent(instructions="...", output="verbose")  # Preset string
```

### Parameters

| Parameter         | Type   | Default | Description                |
| ----------------- | ------ | ------- | -------------------------- |
| `verbose`         | `bool` | `False` | Enable verbose output      |
| `markdown`        | `bool` | `True`  | Format output as markdown  |
| `show_reasoning`  | `bool` | `False` | Show agent reasoning steps |
| `show_tool_calls` | `bool` | `True`  | Display tool call details  |
| `streaming`       | `bool` | `False` | Enable streaming output    |

### Presets

| Preset      | Description            |
| ----------- | ---------------------- |
| `"silent"`  | Minimal output         |
| `"minimal"` | Basic output only      |
| `"actions"` | Show actions (default) |
| `"verbose"` | Detailed output        |

***

## ExecutionConfig

Configuration for agent execution parameters.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import ExecutionConfig

config = ExecutionConfig(
    max_iter=20,
    max_retry_limit=5,
    timeout=300,
)

# Using presets
from praisonaiagents import Agent
agent = Agent(instructions="...", execution="thorough")
```

### Parameters

| Parameter              | Type                  | Default  | Description                                                                                                  |
| ---------------------- | --------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| `max_iter`             | `int`                 | `20`     | Maximum iterations                                                                                           |
| `max_retry_limit`      | `int`                 | `2`      | Max retries for retryable tool and guardrail failures                                                        |
| `retry_initial_delay`  | `float`               | `1.0`    | First retry delay (seconds)                                                                                  |
| `retry_backoff_factor` | `float`               | `2.0`    | Exponential backoff multiplier                                                                               |
| `retry_jitter`         | `float`               | `0.1`    | Jitter fraction of base delay                                                                                |
| `timeout`              | `int`                 | `None`   | Execution timeout in seconds                                                                                 |
| `code_execution`       | `bool`                | `False`  | Enable code execution                                                                                        |
| `code_mode`            | `str`                 | `"safe"` | Code execution mode ("safe" or "unsafe")                                                                     |
| `code_tools`           | `bool`                | `False`  | When `True`, model-generated code may call the agent's registered tools via injected proxies                 |
| `code_tools_allow`     | `Optional[List[str]]` | `None`   | Explicit per-run allow-list of tool names callable from code. `None`/empty = no tools exposed (safe default) |
| `rate_limiter`         | `Any`                 | `None`   | Rate limiter instance                                                                                        |
| `allow_code_execution` | `bool`                | `False`  | ⚠️ Deprecated — use `code_execution`                                                                         |

### Presets

| Preset       | Description                   |
| ------------ | ----------------------------- |
| `"fast"`     | Quick execution (max\_iter=5) |
| `"balanced"` | Balanced (max\_iter=20)       |
| `"thorough"` | Thorough (max\_iter=25)       |

***

## KnowledgeConfig

Configuration for RAG and knowledge retrieval.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import KnowledgeConfig

config = KnowledgeConfig(
    sources=["docs/", "data.pdf"],
    retrieval_k=10,
    rerank=True,
)
```

### Parameters

| Parameter             | Type        | Default | Description                  |
| --------------------- | ----------- | ------- | ---------------------------- |
| `sources`             | `List[str]` | `[]`    | Knowledge source paths       |
| `retrieval_k`         | `int`       | `5`     | Number of chunks to retrieve |
| `retrieval_threshold` | `float`     | `0.0`   | Minimum similarity threshold |
| `rerank`              | `bool`      | `False` | Enable reranking             |
| `auto_retrieve`       | `bool`      | `True`  | Automatic context retrieval  |

***

## PlanningConfig

Configuration for planning mode.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import PlanningConfig

config = PlanningConfig(
    llm="gpt-4o",
    auto_approve=False,
    read_only=True,
)
```

### Parameters

| Parameter      | Type   | Default | Description                                |
| -------------- | ------ | ------- | ------------------------------------------ |
| `llm`          | `str`  | `None`  | LLM for planning (defaults to agent's LLM) |
| `tools`        | `List` | `None`  | Tools available for planning               |
| `reasoning`    | `bool` | `False` | Enable reasoning in plans                  |
| `auto_approve` | `bool` | `False` | Auto-approve plans                         |
| `read_only`    | `bool` | `False` | Only read-only operations                  |

***

## ReflectionConfig

Configuration for self-reflection.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import ReflectionConfig

config = ReflectionConfig(
    min_iterations=1,
    max_iterations=5,
    prompt="Evaluate your response for accuracy...",
)
```

### Parameters

| Parameter        | Type  | Default | Description                   |
| ---------------- | ----- | ------- | ----------------------------- |
| `min_iterations` | `int` | `1`     | Minimum reflection iterations |
| `max_iterations` | `int` | `3`     | Maximum reflection iterations |
| `llm`            | `str` | `None`  | LLM for reflection            |
| `prompt`         | `str` | `None`  | Custom reflection prompt      |

***

## GuardrailConfig

Configuration for guardrails and safety validation.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import GuardrailConfig, GuardrailAction

config = GuardrailConfig(
    validator=my_validator_fn,
    max_retries=5,
    on_fail=GuardrailAction.RAISE,
)
```

### Parameters

| Parameter     | Type              | Default | Description                                    |
| ------------- | ----------------- | ------- | ---------------------------------------------- |
| `validator`   | `Callable`        | `None`  | Validation function                            |
| `description` | `str`             | `None`  | Guardrail description for LLM-based validation |
| `max_retries` | `int`             | `3`     | Maximum retries on failure                     |
| `on_fail`     | `GuardrailAction` | `RETRY` | Action on failure (RETRY, SKIP, RAISE)         |
| `policies`    | `List[str]`       | `[]`    | Policy strings                                 |

***

## WebConfig

Configuration for web search capabilities.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import WebConfig, WebSearchProvider

config = WebConfig(
    provider=WebSearchProvider.TAVILY,
    max_results=10,
)
```

### Parameters

| Parameter       | Type                | Default      | Description            |
| --------------- | ------------------- | ------------ | ---------------------- |
| `provider`      | `WebSearchProvider` | `DUCKDUCKGO` | Search provider        |
| `max_results`   | `int`               | `5`          | Maximum search results |
| `fetch_content` | `bool`              | `True`       | Fetch page content     |

***

## Bool/String/Config Pattern

All config classes follow the "progressive disclosure" pattern:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

# Level 1: Boolean toggle (simplest)
Agent(memory=True)

# Level 2: String preset
Agent(output="verbose")

# Level 3: Config object (full control)
Agent(memory=MemoryConfig(user_id="user123", backend=MemoryBackend.SQLITE))
```

This pattern applies to: `memory`, `knowledge`, `planning`, `reflection`, `guardrails`, `web`, `output`, `execution`, `caching`, `hooks`, `skills`, `autonomy`.

***

## See Also

* [Agent Configuration](/docs/configuration/agent-config)
* [Memory Configuration](/docs/configuration/memory-config)
* [praisonaiagents SDK](/docs/sdk/praisonaiagents/index)
