Prerequisites

  • Python 3.10 or higher
  • PraisonAI Agents package installed
  • Basic understanding of Python

Quick Start

Create multiple AI agents that can work together in just a few lines of code!

1

Install Package

First, install the PraisonAI Agents package:

pip install praisonaiagents
2

Import Required Components

Import the necessary components:

from praisonaiagents import Agent, Agents
3

Create Your Agents

Create specialized agents with specific roles:

summarise_agent = Agent(instructions="Summarise what is Photosynthesis")
4

Start Your Agents

Initialize and run your agents:

agents = Agents(agents=[summarise_agent])
agents.start()

Understanding Mini AI Agents

What are Mini AI Agents?

Mini AI Agents are simplified yet powerful AI agents that can:

  • Work together to accomplish tasks
  • Use tools like internet search
  • Process and summarize information
  • Execute tasks sequentially

Key Components

Agent

Individual AI agents with specific roles and capabilities

Agent(instructions="Your agent's role description")

Tools

Built-in tools that agents can use

tools=[Tools.internet_search]

Agents Manager

Coordinates multiple agents

Agents(agents=[agent1, agent2])

Sequential Flow

Agents work in sequence, passing results to each other

Available Tools

Internet Search

Tools.internet_search

Search the internet using DuckDuckGo

Requires: pip install duckduckgo_search

Examples

Basic Research and Summary

pip install praisonaiagents duckduckgo_search
from praisonaiagents import Agent, Agents, Tools

# Create a research agent
research_agent = Agent(
    instructions="You are a research agent to search internet about AI 2024",
    tools=[Tools.internet_search]
)

# Create a summarize agent
summarise_agent = Agent(
    instructions="You are a summarize agent to summarise research agent's findings"
)

# Initialize and run agents
agents = Agents(agents=[research_agent, summarise_agent])
agents.start()

Custom Instructions

Best Practices

Common Patterns

Research and Analysis

# Research agent
researcher = Agent(
    instructions="Research latest developments in quantum computing",
    tools=[Tools.internet_search]
)

# Analysis agent
analyst = Agent(
    instructions="Analyze and explain the research findings in simple terms"
)

agents = Agents(agents=[researcher, analyst])

Information Processing

# Data collector
collector = Agent(
    instructions="Collect information about renewable energy",
    tools=[Tools.internet_search]
)

# Summarizer
summarizer = Agent(
    instructions="Create a concise summary of the collected information"
)

# Report writer
writer = Agent(
    instructions="Write a detailed report based on the summary"
)

agents = Agents(agents=[collector, summarizer, writer])

Troubleshooting

Tool Not Available

If using Tools.internet_search, install required package:

pip install duckduckgo_search

Agent Communication

Ensure agent instructions are clear and complementary

Next Steps

Mini AI Agents are designed to be simple yet powerful. They’re perfect for quick prototypes and straightforward automation tasks.

Was this page helpful?