-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhn_analysis.py
More file actions
34 lines (26 loc) · 842 Bytes
/
hn_analysis.py
File metadata and controls
34 lines (26 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import asyncio
from capyswarm import Swarm, Agent
from dotenv import load_dotenv
import os
load_dotenv()
async def main():
browser_agent = Agent(
name="Browser Agent",
prompt="You are specialized in web browsing and data extraction.",
orchestrator=False,
)
data_agent = Agent(
name="Data Agent",
prompt="You are specialized in processing and analyzing data.",
orchestrator=False,
)
orchestrator = Agent(name="Orchestrator", orchestrator=True)
async with Swarm(
[browser_agent, data_agent, orchestrator],
api_key=os.getenv("SCRAPYBARA_API_KEY"),
) as swarm:
await swarm.run(
prompt="Collect and analyze the top 5 posts from Hacker News (news.ycombinator.com).",
)
if __name__ == "__main__":
asyncio.run(main())