Other Features
PraisonAI Agents
Guide for using PraisonAI Agents framework, a lightweight package for creating and managing AI agents with advanced capabilities
A lightweight package dedicated to creating and managing AI agents with advanced capabilities.
Installation
Quick Start
Create app.py
and add the following code:
Agent Configuration
Core Attributes
name
: Agent’s identifierrole
: Agent’s function/expertisegoal
: Individual objectivebackstory
: Context and personality-
llm
: Language model (default: OpenAI’s GPT-4) -
verbose
: Enable detailed logs (default: False) -
markdown
: Enable markdown formatting (default: True)
Optional Attributes
tools
: List of available tools-
memory
: Enable conversation history (default: True) -
max_iter
: Maximum iterations (default: 20) max_rpm
: Rate limit for API calls-
allow_delegation
: Enable task delegation (default: False)
Task Configuration
Core Attributes
description
: Task detailsexpected_output
: Desired outcomeagent
: Assigned agent
Optional Attributes
context
: Dependencies on other taskstools
: Task-specific tools-
async_execution
: Run asynchronously (default: False) output_file
: Save output to filecallback
: Post-task function
Advanced Features
Tool Integration
Custom Callbacks
Error Handling
The framework includes built-in error handling for:
- API rate limits
- Token limits
- Task timeouts
- Tool execution failures
Best Practices
-
Agent Design
- Give clear, specific roles and goals
- Provide detailed backstories
- Use appropriate tools for tasks
-
Task Management
- Break complex tasks into subtasks
- Set clear dependencies
- Use async execution for independent tasks
-
Resource Optimization
- Enable caching when appropriate
- Set reasonable max_iter limits
- Use rate limiting for API calls
-
Error Handling
- Implement task callbacks
- Set appropriate timeouts
- Monitor execution logs