Skip to content

Commit 0010f93

Browse files
Merge pull request #325 from MervinPraison/develop
Update documentation and examples for agent initialization and usage
2 parents 76949e5 + ff9e5ff commit 0010f93

File tree

3 files changed

+407
-194
lines changed

3 files changed

+407
-194
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Create app.py file and add the code below:
7171
```python
7272
from praisonaiagents import Agent
7373
agent = Agent(instructions="Your are a helpful AI assistant")
74-
agent.chat("Write a movie script about a robot in Mars")
74+
agent.start("Write a movie script about a robot in Mars")
7575
```
7676

7777
Run:
@@ -472,6 +472,8 @@ export OPENAI_BASE_URL=https://api.groq.com/openai/v1
472472

473473
### Simple Playbook Example
474474

475+
Create `agents.yaml` file and add the code below:
476+
475477
```yaml
476478
framework: praisonai
477479
topic: Artificial Intelligence

docs/concepts/agents.mdx

+12-76
Original file line numberDiff line numberDiff line change
@@ -112,86 +112,22 @@ graph LR
112112
<Step title="Create Agent">
113113
Create `app.py`:
114114
<CodeGroup>
115-
```python Single Agent
116-
from praisonaiagents import Agent, Task, PraisonAIAgents
115+
```python Single Agent
116+
from praisonaiagents import Agent
117117

118-
# Create an agent
119-
researcher = Agent(
120-
name="Researcher",
121-
role="Senior Research Analyst",
122-
goal="Uncover cutting-edge developments in AI",
123-
backstory="You are an expert at a technology research group",
124-
verbose=True,
125-
llm="gpt-4o"
126-
)
127-
128-
# Define a task
129-
task = Task(
130-
name="research_task",
131-
description="Analyze 2024's AI advancements",
132-
expected_output="A detailed report",
133-
agent=researcher
134-
)
135-
136-
# Run the agents
137-
agents = PraisonAIAgents(
138-
agents=[researcher],
139-
tasks=[task],
140-
verbose=False
141-
)
142-
143-
result = agents.start()
144-
```
145-
146-
```python Multiple Agents
147-
from praisonaiagents import Agent, Task, PraisonAIAgents
148-
149-
# Create multiple agents
150-
researcher = Agent(
151-
name="Researcher",
152-
role="Senior Research Analyst",
153-
goal="Uncover cutting-edge developments in AI",
154-
backstory="You are an expert at a technology research group",
155-
verbose=True,
156-
llm="gpt-4o",
157-
markdown=True
158-
)
159-
160-
writer = Agent(
161-
name="Writer",
162-
role="Tech Content Strategist",
163-
goal="Craft compelling content on tech advancements",
164-
backstory="You are a content strategist",
165-
llm="gpt-4o",
166-
markdown=True
167-
)
168-
169-
# Define multiple tasks
170-
task1 = Task(
171-
name="research_task",
172-
description="Analyze 2024's AI advancements",
173-
expected_output="A detailed report",
174-
agent=researcher
175-
)
118+
agent = Agent(instructions="Your are a helpful AI assistant")
119+
agent.start("Write a movie script about a robot in Mars")
120+
```
176121

177-
task2 = Task(
178-
name="writing_task",
179-
description="Create a blog post about AI advancements",
180-
expected_output="A blog post",
181-
agent=writer
182-
)
122+
```python Multi Agents
123+
from praisonaiagents import Agent, PraisonAIAgents
183124

184-
# Run with hierarchical process
185-
agents = PraisonAIAgents(
186-
agents=[researcher, writer],
187-
tasks=[task1, task2],
188-
verbose=False,
189-
process="hierarchical",
190-
manager_llm="gpt-4o"
191-
)
125+
research_agent = Agent(instructions="Research about AI")
126+
summarise_agent = Agent(instructions="Summarise research agent's findings")
192127

193-
result = agents.start()
194-
```
128+
agents = PraisonAIAgents(agents=[research_agent, summarise_agent])
129+
agents.start()
130+
```
195131
</CodeGroup>
196132
</Step>
197133

0 commit comments

Comments
 (0)