Skip to main content
Let’s build your first AI agent in 5 minutes! Follow along step by step.

Step-by-Step Guide

1

Install PraisonAI

Open your terminal and run:
pip install praisonaiagents
2

Set Your API Key

Set your OpenAI API key:
export OPENAI_API_KEY=your_key_here
Get your API key from platform.openai.com
3

Create Your Agent File

Create a new file called my_agent.py:
from praisonaiagents import Agent

# Create your first agent
agent = Agent(
    name="ResearchAssistant",
    instructions="You are a helpful research assistant. Explain things simply and clearly."
)

# Ask it a question
agent.start("Explain how solar panels work in simple terms")
4

Run Your Agent

python my_agent.py
You should see the agent’s response explaining solar panels!

How It Works

StepWhat Happens
InstructionsTell the agent who it is and how to behave
QuestionYour message or task
LLMAI model processes everything
ResponseAgent returns the answer

Try Different Agents

Coding Helper

from praisonaiagents import Agent

coder = Agent(
    name="CodeHelper",
    instructions="You are a Python expert. Explain code simply and provide working examples."
)

coder.start("How do I read a CSV file in Python?")

Creative Writer

from praisonaiagents import Agent

writer = Agent(
    name="StoryWriter",
    instructions="You write short, engaging stories with vivid descriptions."
)

writer.start("Write a short story about a robot learning to paint")

Math Tutor

from praisonaiagents import Agent

tutor = Agent(
    name="MathTutor",
    instructions="You explain math concepts step by step. Use simple language."
)

tutor.start("Explain how percentages work")

Complete Example

from praisonaiagents import Agent

# Create a research assistant
assistant = Agent(
    name="ResearchAssistant",
    instructions="""You are a helpful research assistant.

When answering:
- Be concise and clear
- Use bullet points when helpful
- Explain complex topics simply
- Admit when you don't know something"""
)

# Ask multiple questions
assistant.start("What are the benefits of exercise?")
assistant.start("How does the internet work?")
assistant.start("Explain climate change in simple terms")

Troubleshooting

API Key Error

Make sure OPENAI_API_KEY is set correctly

Module Not Found

Run pip install praisonaiagents again

No Response

Check your internet connection

Slow Response

First request may take a few seconds

What’s Next?

Give your agent superpowers like web search and calculations
Let your agent remember conversations
Give your agent access to your documents
Create multiple agents that work together

Next: Adding Tools to Agents

Learn how to give your agents superpowers with tools.