-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhn_mal.py
More file actions
42 lines (34 loc) · 1.31 KB
/
hn_mal.py
File metadata and controls
42 lines (34 loc) · 1.31 KB
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
35
36
37
38
39
40
41
42
import asyncio
from capyswarm import Swarm, Agent
from dotenv import load_dotenv
import os
load_dotenv()
async def main():
hn_agent = Agent(
name="Hacker News Agent",
prompt="You are specialized in web browsing and data extraction from Hacker News.",
instance="s-hnagent", # Change this to a unique identifier for the instance
color=(183, 65, 14),
orchestrator=False,
)
mal_agent = Agent(
name="MyAnimeList Agent",
prompt="You are specialized in web browsing and data extraction from MyAnimeList.",
instance="s-malagent", # Change this to a unique identifier for the instance
color=(47, 82, 162),
orchestrator=False,
)
orchestrator = Agent(
name="Orchestrator",
color=(255, 0, 0),
instance="s-hnagent", # Change this to one of the instance ids of the agents (doesn't matter which for this example)
orchestrator=True,
)
async with Swarm(
[hn_agent, mal_agent, orchestrator], api_key=os.getenv("SCRAPYBARA_API_KEY")
) as swarm:
await swarm.run(
prompt="Collect the titles of the top 5 posts from Hacker News (news.ycombinator.com) and the titles of the top 5 anime from MyAnimeList (myanimelist.net)",
)
if __name__ == "__main__":
asyncio.run(main())