Configuration Module
Configure agents with type-safe presets, resolvers, and feature configs
Configure your agents with powerful presets and type-safe configuration options.
Quick Start
- Simple Configuration
typescript import { Agent, MemoryConfig } from 'praisonai'; const agent = new Agent({ name: "Assistant", instructions: "Be helpful", memory: { backend: 'file', autoMemory: true } }); await agent.start("Hello!"); - With Presets
typescript import { Agent, OutputPreset, ExecutionPreset } from 'praisonai'; const agent = new Agent({ name: "Fast Agent", instructions: "Quick responses", output: { verbose: true, stream: true }, execution: { maxIter: 5 } });
Configuration Interfaces
Memory Configuration
import { MemoryConfig, MemoryBackend } from 'praisonai';
const memoryConfig: MemoryConfig = {
backend: MemoryBackend.FILE,
userId: "user-123",
sessionId: "session-456",
autoMemory: true,
history: true,
historyLimit: 100,
storePath: "./memory"
};| Option | Type | Default | Description |
|---|---|---|---|
backend | MemoryBackend | 'file' | Storage backend (file, sqlite, redis, postgres) |
userId | string | undefined | User identifier for memory isolation |
sessionId | string | undefined | Session identifier |
autoMemory | boolean | false | Enable automatic memory management |
history | boolean | true | Store conversation history |
historyLimit | number | 100 | Maximum history entries |
storePath | string | './memory' | File storage path |
Output Configuration
import { OutputConfig, OutputPreset } from 'praisonai';
const outputConfig: OutputConfig = {
verbose: true,
markdown: true,
stream: true,
metrics: false,
reasoningSteps: true
};| Option | Type | Default | Description |
|---|---|---|---|
verbose | boolean | false | Enable verbose logging |
markdown | boolean | true | Format output as markdown |
stream | boolean | false | Enable streaming responses |
metrics | boolean | false | Show performance metrics |
reasoningSteps | boolean | false | Display reasoning steps |
Execution Configuration
import { ExecutionConfig, ExecutionPreset } from 'praisonai';
const executionConfig: ExecutionConfig = {
maxIter: 10,
maxRetryLimit: 3,
maxRpm: 60,
maxExecutionTime: 300
};| Option | Type | Default | Description |
|---|---|---|---|
maxIter | number | 10 | Maximum iterations |
maxRetryLimit | number | 3 | Maximum retries on failure |
maxRpm | number | 60 | Rate limit (requests per minute) |
maxExecutionTime | number | 300 | Timeout in seconds |
Enums
Memory Backend
import { MemoryBackend } from 'praisonai';
// Available backends
MemoryBackend.FILE // File-based storage
MemoryBackend.SQLITE // SQLite database
MemoryBackend.REDIS // Redis cache
MemoryBackend.POSTGRES // PostgreSQL database
MemoryBackend.MEM0 // Mem0 integration
MemoryBackend.MONGODB // MongoDB databaseOutput Preset
import { OutputPreset } from 'praisonai';
OutputPreset.SILENT // No output
OutputPreset.STATUS // Status updates only
OutputPreset.TRACE // Trace logging
OutputPreset.VERBOSE // Full verbose output
OutputPreset.DEBUG // Debug mode
OutputPreset.STREAM // Streaming output
OutputPreset.JSON // JSON formatExecution Preset
import { ExecutionPreset } from 'praisonai';
ExecutionPreset.FAST // Quick execution (maxIter: 10)
ExecutionPreset.BALANCED // Balanced (maxIter: 20)
ExecutionPreset.THOROUGH // Thorough (maxIter: 50)
ExecutionPreset.UNLIMITED // No limits (maxIter: 1000)Common Patterns
Full Config
import { Agent, PraisonConfig } from 'praisonai';
const config: PraisonConfig = {
defaults: { llm: 'gpt-4o-mini', temperature: 0.7 },
memory: { backend: 'file', autoMemory: true },
output: { verbose: true, stream: true },
execution: { maxIter: 10 },
caching: { enabled: true, ttl: 3600 }
};
const agent = new Agent({
name: "Configured Agent",
instructions: "Be helpful",
...config
});Multi-Agent Config
import { AgentTeam, MultiAgentMemoryConfig } from 'praisonai';
const memoryConfig: MultiAgentMemoryConfig = {
backend: 'redis',
sharedMemory: true,
isolatedSessions: false
};
const team = new AgentTeam({
agents: [agent1, agent2],
memory: memoryConfig
});API Reference
MemoryConfig
Memory configuration options
ExecutionConfigExecution configuration options
OutputConfigOutput configuration options
PraisonConfigFull configuration interface
Best Practices
Use presets for common scenarios
Start with presets like ExecutionPreset.FAST for quick tasks or ExecutionPreset.THOROUGH for complex research.
Configure memory for persistence
Enable autoMemory: true to automatically persist important context across sessions.
Set appropriate rate limits
Use maxRpm to prevent API rate limiting, especially in production environments.