Skip to main content

Parameter Resolution

PraisonAI Agents uses a unified parameter resolution system that provides flexible configuration through multiple input types while maintaining predictable precedence rules.

Precedence Rules

Resolution Order (Highest to Lowest)

When multiple configuration sources are provided, the system resolves them in this order:

User-Friendly Progression

When learning the API, start simple and add complexity as needed:
Example progression for memory:

Unified Parameter Table

String Parsing Rules

URL Scheme Detection

URLs are automatically detected and parsed:

Path Detection

File and directory paths are detected:

Preset Lookup

String values are matched against preset registries:

Error Handling with Typo Suggestions

Invalid values trigger helpful error messages:

Dict Parsing Rules

Config Shorthand

Dicts provide a convenient shorthand for configuration without importing config classes:

Strict Validation

Dict keys are strictly validated against the config class fields. Unknown keys raise a clear TypeError:

When to Use Dict vs Config

Important: base_url and api_key are NOT consolidated parameters. They remain separate, explicit parameters on Agent:

Array Parsing Rules

Memory Parameter: The memory parameter uses ArrayMode.SINGLE_OR_LIST, which only accepts single-item arrays. For multiple values or preset + overrides, use dict or config object instead.

Preset with Overrides

The most common array pattern combines a preset with custom options:

Multiple Sources

For knowledge and skills, arrays can specify multiple sources:

Provider with Mode

For web search, arrays can specify provider and mode:

Config Classes Reference

MemoryConfig

KnowledgeConfig

OutputConfig

ExecutionConfig

WebConfig

PlanningConfig

ReflectionConfig

GuardrailConfig

Performance Considerations

O(1) Happy Path

The resolver is optimized for the common case:
  • Bool/None: Immediate return (no parsing)
  • Instance: Type check only
  • Config: Direct use
  • String preset: Dictionary lookup

Expensive Operations (Error Path Only)

These only run when validation fails:
  • Typo suggestion (Levenshtein distance calculation)
  • URL scheme parsing
  • Path validation

API Consistency Matrix

PraisonAI uses consolidated parameters that are consistent across all major classes. This enables a unified API where features work the same way regardless of which class you use.

Consolidated Parameters

Task Design: Task intentionally lacks llm and output because it delegates to an Agent which holds these settings. Use task.agent.llm for the LLM and output_config for output settings.

Config Classes by Feature

Import Patterns

One-Line Imports

Resolver Utilities (Advanced)

See Also