Set your OpenAI API key as an environment variable in your terminal:
Copy
export OPENAI_API_KEY=your_api_key_here
3
Create a file
Create a new file app.py with the basic setup:
Copy
from praisonaiagents import Agent, Task, PraisonAIAgents# Create an agent with self-reflectionagent = Agent( role="Senior Research Analyst", goal="Analyze and provide insights on given topics", backstory="You are an expert analyst with strong critical thinking skills", self_reflect=True # Enable self-reflection)# Create a tasktask = Task( description="Analyze recent developments in AI", expected_output="A detailed analysis report", agent=agent)# Create and start the agentsagents = PraisonAIAgents( agents=[agent], tasks=[task], process="sequential", verbose=2)# Start executionagents.start()
4
Start Agents
Type this in your terminal to run your agents:
Copy
python app.py
1
Install Package
Install the PraisonAI package:
Copy
pip install praisonai
2
Set API Key
Set your OpenAI API key as an environment variable in your terminal:
Copy
export OPENAI_API_KEY=your_api_key_here
3
Create a file
Create a new file agents.yaml with the basic setup:
Copy
framework: praisonaiprocess: sequentialtopic: create movie script about cat in marsagents: # Canonical: use 'agents' instead of 'roles' scriptwriter: instructions: # Canonical: use 'instructions' instead of 'backstory' Expert in dialogue and script structure, translating concepts into scripts. goal: Write a movie script about a cat in Mars role: Scriptwriter self_reflect: true min_reflect: 1 max_reflect: 2 tasks: scriptwriting_task: description: Turn the story concept into a production-ready movie script, including dialogue and scene details. expected_output: Final movie script with dialogue and scene details. tools: - search_tool
4
Start Agents
Type this in your terminal to run your agents:
Copy
praisonai agents.yaml
Requirements
Python 3.10 or higher
OpenAI API key. Generate OpenAI API key here. Use Other models using this guide.
Set your OpenAI API key as an environment variable in your terminal:
Copy
export OPENAI_API_KEY=your_api_key_here
3
Create a file
Create a new file app.py with the basic setup:
Copy
from praisonaiagents import Agent, Task, PraisonAIAgents# Create first agent with self-reflectionresearcher = Agent( role="Senior Research Analyst", goal="Research and analyze AI developments", backstory="Expert analyst specializing in AI trends and impacts", self_reflect=True, verbose=True)# Create second agent with self-reflectionwriter = Agent( role="Technical Writer", goal="Transform research into clear documentation", backstory="Experienced in creating technical content and documentation", self_reflect=True, verbose=True)# Create first taskresearch_task = Task( description="Research and analyze recent AI developments", expected_output="Comprehensive analysis of AI trends", agent=researcher)# Create second taskdocumentation_task = Task( description="Create technical documentation from research findings", expected_output="Well-structured technical documentation", agent=writer)# Create and start the agentsagents = PraisonAIAgents( agents=[researcher, writer], tasks=[research_task, documentation_task], process="sequential")# Start executionagents.start()
4
Start Agents
Type this in your terminal to run your agents:
Copy
python app.py
1
Install Package
Install the PraisonAI package:
Copy
pip install praisonai duckduckgo_search
2
Set API Key
Set your OpenAI API key as an environment variable in your terminal:
Copy
export OPENAI_API_KEY=your_api_key_here
3
Create a file
Create a new file agents.yaml with the basic setup:
Copy
framework: praisonaiprocess: sequentialtopic: create technical documentation about AI trendsagents: # Canonical: use 'agents' instead of 'roles' researcher: instructions: # Canonical: use 'instructions' instead of 'backstory' Expert analyst specializing in AI trends and their implications. goal: Research and analyze current AI developments role: Senior Research Analyst self_reflect: true min_reflect: 1 max_reflect: 2 tasks: research_task: description: Research and analyze recent developments in AI technology. expected_output: Comprehensive analysis of current AI trends. tools: - duckduckgo writer: instructions: # Canonical: use 'instructions' instead of 'backstory' Experienced technical writer skilled in creating clear documentation. goal: Transform research into accessible documentation role: Technical Writer tasks: documentation_task: description: Create technical documentation from research findings. expected_output: Well-structured technical documentation.