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
from praisonaiagents import (
MemoryConfig,
OutputConfig,
ExecutionConfig,
PlanningConfig,
)Or use the namespace style:
import praisonaiagents as pa
config = pa.config.MemoryConfig(user_id="user123")Configuration Classes
Memory and session management
KnowledgeConfigRAG and knowledge retrieval
OutputConfigOutput formatting and verbosity
ExecutionConfigAgent execution parameters
Planning mode settings
ReflectionConfigSelf-reflection settings
GuardrailConfigSafety and validation
WebConfigWeb search configuration
MemoryConfig
Configuration for agent memory and session management.
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, CHROMA, MEM0, MONGODB, DAKERA, IN_MEMORY) |
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.
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 stringParameters
| 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.
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.
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.
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.
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.
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.
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:
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.