1
+ import os
2
+ from datetime import datetime , timezone
3
+ from agency_swarm import Agent , Agency , set_openai_key
4
+ from prompts import (
5
+ researcher_description ,
6
+ researcher_instructions ,
7
+ manager_description ,
8
+ manager_instructions ,
9
+ mission_statement_prompt
10
+ )
11
+ from tools import SearchEngine , ScrapeWebsite
12
+ from utils import load_config
13
+
14
+ # loads API keys from config.yaml
15
+ load_config (file_path = "./config.yaml" )
16
+ OPENAI_API_KEY = os .getenv ("OPENAI_API_KEY" )
17
+ set_openai_key (OPENAI_API_KEY )
18
+
19
+
20
+ def get_current_utc_datetime ():
21
+ now_utc = datetime .now (timezone .utc )
22
+ current_time_utc = now_utc .strftime ("%Y-%m-%d %H:%M:%S %Z" )
23
+ return current_time_utc
24
+
25
+ manager_instructions_with_datetime = manager_instructions .format (datetime = get_current_utc_datetime ())
26
+ manager = Agent (name = "Manager" ,
27
+ description = manager_description ,
28
+ instructions = manager_instructions ,
29
+ temperature = 0 ,
30
+ # max_prompt_tokens=25000,
31
+ model = "gpt-4o"
32
+ )
33
+
34
+ researcher = Agent (name = "Researcher" ,
35
+ description = researcher_description ,
36
+ instructions = researcher_instructions ,
37
+ tools = [SearchEngine , ScrapeWebsite ],
38
+ temperature = 0 ,
39
+ model = "gpt-4o"
40
+ )
41
+
42
+ agency = Agency ([
43
+ manager ,
44
+ [manager , researcher ],
45
+ ],
46
+ shared_instructions = mission_statement_prompt ,
47
+ temperature = 0 ,
48
+ )
49
+
50
+ if __name__ == "__main__" :
51
+ agency .run_demo ()
0 commit comments