Skip to content

Commit f81752a

Browse files
committed
Add back legacy team docs
1 parent 9c13535 commit f81752a

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

agents/teams.mdx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Teams
3+
---
4+
<Warning>
5+
`Agent.team` is deprecated. We suggest using our [Team](/teams) feature instead, which is much more flexible and powerful.
6+
</Warning>
7+
8+
We can combine multiple Agents to form a team and tackle tasks as a cohesive unit. Here's a simple example that converts an agent into a team to write an article about the top stories on hackernews.
9+
10+
```python hackernews_team.py
11+
from agno.agent import Agent
12+
from agno.models.openai import OpenAIChat
13+
from agno.tools.hackernews import HackerNewsTools
14+
from agno.tools.duckduckgo import DuckDuckGoTools
15+
from agno.tools.newspaper4k import Newspaper4kTools
16+
17+
hn_researcher = Agent(
18+
name="HackerNews Researcher",
19+
model=OpenAIChat("gpt-4o"),
20+
role="Gets top stories from hackernews.",
21+
tools=[HackerNewsTools()],
22+
)
23+
24+
web_searcher = Agent(
25+
name="Web Searcher",
26+
model=OpenAIChat("gpt-4o"),
27+
role="Searches the web for information on a topic",
28+
tools=[DuckDuckGoTools()],
29+
add_datetime_to_instructions=True,
30+
)
31+
32+
article_reader = Agent(
33+
name="Article Reader",
34+
model=OpenAIChat("gpt-4o"),
35+
role="Reads articles from URLs.",
36+
tools=[Newspaper4kTools()],
37+
)
38+
39+
hn_team = Agent(
40+
name="Hackernews Team",
41+
model=OpenAIChat("gpt-4o"),
42+
team=[hn_researcher, web_searcher, article_reader],
43+
instructions=[
44+
"First, search hackernews for what the user is asking about.",
45+
"Then, ask the article reader to read the links for the stories to get more information.",
46+
"Important: you must provide the article reader with the links to read.",
47+
"Then, ask the web searcher to search for each story to get more information.",
48+
"Finally, provide a thoughtful and engaging summary.",
49+
],
50+
show_tool_calls=True,
51+
markdown=True,
52+
)
53+
hn_team.print_response("Write an article about the top 2 stories on hackernews", stream=True)
54+
```
55+
56+
Run the script to see the output.
57+
58+
```bash
59+
pip install -U openai duckduckgo-search newspaper4k lxml_html_clean agno
60+
61+
python hackernews_team.py
62+
```
63+
64+
## How to build Agent Teams
65+
66+
1. Add a `name` and `role` parameter to the member Agents.
67+
2. Create a Team Leader that can delegate tasks to team-members.
68+
3. Use your Agent team just like you would use a regular Agent.

mint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
"agents/tools",
9898
"agents/knowledge",
9999
"agents/memory",
100-
"agents/storage"
100+
"agents/storage",
101+
"agents/teams"
101102
]
102103
},
103104
{

0 commit comments

Comments
 (0)