Skip to main content

Understanding Agents

Agents are the core building blocks of PraisonAI. Each agent is an autonomous AI entity with specific roles, goals, and capabilities.

Single Agent vs Multi-Agent


Agent Architecture

Key Components

Role & Goal

Defines the agent’s purpose and objectives through role definition and specific goals

Capabilities

Tools and functions available to the agent for task execution

Memory

Context retention and learning capabilities across interactions

Language Model

The underlying AI model powering the agent’s intelligence

Component Details

Role and Goal

Clear role and goal definitions are crucial for optimal agent performance.

Capabilities

1

Install PraisonAI

Install the core package:
Terminal
2

Configure Environment

Terminal
Generate your OpenAI API key from OpenAI Use other LLM providers like Ollama, Anthropic, Groq, Google, etc. Please refer to the Models for more information.
3

Create Agent

Create app.py:
4

Start Agents

Execute your script:
Terminal
You should see:
  • Agent initialization
  • Agents progress
  • Final results
  • Generated report

Agent Types

Basic Agent

Perfect for straightforward tasks and direct interactions
  • Single-purpose focus
  • Direct user interaction
  • Limited tool set
  • Ideal for simple tasks

Specialized Agent

Experts in specific domains with advanced capabilities
  • Domain expertise
  • Advanced capabilities
  • Custom tools
  • Deep knowledge base

Collaborative Agent

Designed for team-based operations and complex workflows
  • Team interaction
  • Task delegation
  • Shared context
  • Coordinated actions

Best Practices

Always implement proper error handling and resource management in your agent configurations.

Agent Design

1

Role Definition

Define clear, specific roles for each agent
2

Goal Setting

Set specific, measurable goals
3

Tool Selection

Choose relevant tools for the task
4

Memory Setup

Configure appropriate memory settings

Agent Interaction

1

Communication

Establish clear communication protocols
2

Delegation

Define explicit delegation rules
3

Error Handling

Implement robust error handling
4

Resource Management

Set up efficient resource allocation

Async Capabilities

Key Features

  • Full async/await support
  • Non-blocking operations
  • Enhanced performance

Advanced Features

Memory Management

  • Short-term conversation memory
  • Long-term knowledge retention
  • Context preservation

Tool Integration

  • Custom tool development
  • External API integration
  • Resource access control

Async Support

Agents now support asynchronous operations through the following methods:
  • achat: Async version of the chat method
  • astart: Async version of start method
  • aexecute_task: Async version of execute_task method
  • arun_task: Async version of run_task method
  • arun_all_tasks: Async version of run_all_tasks method

Example Usage:

Key Features:

  • Full async/await support
  • Parallel task execution
  • Async tool integration
  • Async callback support
  • Mixed sync/async operations

Next Steps

Create Your First Agent

Follow our quickstart guide to create your first agent

API Reference

Explore the complete Agent API documentation