Skip to main content
An Agent is an AI that follows your instructions, uses tools, and completes tasks through conversation.
from praisonaiagents import Agent

agent = Agent(
    name="Assistant",
    instructions="You are a helpful research assistant. Answer questions accurately and concisely.",
)

agent.start("What are the main benefits of solar energy?")
The user asks a question; the agent runs a single turn and returns the answer.

Quick Start

1

Simple Agent

from praisonaiagents import Agent

agent = Agent(instructions="You are a helpful assistant.")
response = agent.start("Explain machine learning in one paragraph.")
print(response)
2

Agent with Tools

from praisonaiagents import Agent
from praisonaiagents.tools import duckduckgo

agent = Agent(
    name="Researcher",
    instructions="You are a research agent. Use web search for current information.",
    tools=[duckduckgo],
)
agent.start("What are the latest developments in quantum computing?")
3

Agent with Features

from praisonaiagents import Agent

agent = Agent(
    name="SmartAssistant",
    instructions="You are a smart assistant that remembers and plans.",
    memory=True,
    planning=True,
    reflection=True,
)
agent.start("Help me plan a comprehensive study schedule for learning Python.")

How It Works

PhaseWhat happens
1. ReceiveAgent receives user input
2. ThinkLLM decides whether to respond or call a tool
3. ActIf tool needed, executes it and feeds result back
4. RespondFinal answer returned to user

Key Parameters

ParameterTypeDescription
namestrAgent name (shown in logs and multi-agent setups)
instructionsstrSystem prompt — what the agent does and how
llmstrModel name (e.g., "gpt-4o", "claude-3-5-sonnet")
toolslistList of tools the agent can use
memorybool | MemoryConfigEnable conversation memory
planningbool | PlanningConfigEnable pre-execution planning
reflectionbool | ReflectionConfigEnable self-review of responses
cachingbool | CachingConfigEnable response caching
outputstr | OutputConfigControl response verbosity
executionstr | ExecutionConfigControl iteration and budget limits

Common Patterns

Pattern 1 — Simple Q&A agent

from praisonaiagents import Agent

agent = Agent(instructions="Answer questions clearly and accurately.")
response = agent.start("What is the difference between RAM and storage?")
print(response)

Pattern 2 — Specialized domain agent

from praisonaiagents import Agent

agent = Agent(
    name="LegalAnalyst",
    instructions="""You are a legal document analyst.
    Identify key clauses, risks, and obligations.
    Always recommend consulting a qualified attorney.""",
    llm="gpt-4o",
)
agent.start("Analyze this software license agreement for unusual terms.")
from praisonaiagents import Agent, MemoryConfig, ExecutionConfig

agent = Agent(
    name="ProductionAgent",
    instructions="You are a reliable production assistant.",
    memory=MemoryConfig(backend="redis", user_id="user_123"),
    execution=ExecutionConfig(max_iter=30, max_budget=0.25),
    caching=True,
)
response = agent.start("Summarize our Q3 performance metrics.")
print(response)

Best Practices

The instructions parameter is your agent’s personality and purpose. Be specific: “You are a customer support agent for Acme Corp. Answer questions about orders, returns, and products. Escalate billing disputes to a human.” Clear instructions outperform vague ones every time.
Start with just Agent(instructions="...") and add features (memory, planning, reflection) one at a time. Each feature has a cost — only add what your use case actually needs.
gpt-4o-mini handles simple Q&A and extraction cheaply and fast. Use gpt-4o or claude-3-5-sonnet for complex reasoning, code generation, and nuanced writing tasks.
Always set name when using multiple agents. Names appear in logs, hooks callbacks, and help diagnose which agent produced which output in complex workflows.

Tools — add capabilities like web search and code execution

Memory — give agents persistent memory across sessions