Elffuss BraidHub

kikocis/Based-Agent public

a87f47c62cfe · 561 BRawPermalink
1import json
2
3from swarm import Agent
4
5
6def get_weather(location, time="now"):
7 """Get the current weather in a given location. Location MUST be a city."""
8 return json.dumps({"location": location, "temperature": "65", "time": time})
9
10
11def send_email(recipient, subject, body):
12 print("Sending email...")
13 print(f"To: {recipient}")
14 print(f"Subject: {subject}")
15 print(f"Body: {body}")
16 return "Sent!"
17
18
19weather_agent = Agent(
20 name="Weather Agent",
21 instructions="You are a helpful agent.",
22 functions=[get_weather, send_email],
23)