HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/PraisonAI/examples/general/structured_agents_example.py
from praisonaiagents import Agent, Task, PraisonAIAgents, Tools
from pydantic import BaseModel

class AnalysisReport(BaseModel):
    title: str
    findings: str
    summary: str

# Create a researcher agent
researcher = Agent(
    name="AIResearcher",
    role="Technology Research Analyst",
    goal="Analyze and structure information about AI developments",
    backstory="Expert analyst specializing in AI technology trends",
    verbose=True,
    llm="gpt-4o-mini",
    tools=[Tools.internet_search],
    self_reflect=False
)

# Create an analyst agent
analyst = Agent(
    name="DataAnalyst",
    role="Data Insights Specialist",
    goal="Structure and analyze research findings",
    backstory="Senior data analyst with expertise in pattern recognition",
    verbose=True,
    llm="gpt-4o-mini",
    self_reflect=False
)

# Define structured tasks
research_task = Task(
    name="gather_research",
    description="Research recent AI developments in 2024",
    agent=researcher,
    expected_output="Research findings"
)

analysis_task = Task(
    name="analyze_findings",
    description="Analyze research findings and create structured report. No additional text or explanation.",
    agent=analyst,
    output_json=AnalysisReport,
    expected_output="JSON object"
)

# Initialize and run agents
agents = PraisonAIAgents(
    agents=[researcher, analyst],
    tasks=[research_task, analysis_task],
    process="sequential",
    verbose=True
)
result = agents.start()
print(result)