Elffuss BraidHub

kikocis/Based-Agent public

b47944ff9368 · 400 BRawPermalink
1from swarm import Swarm, Agent
2
3client = Swarm()
4
5
6def get_weather(location) -> str:
7 return "{'temp':67, 'unit':'F'}"
8
9
10agent = Agent(
11 name="Agent",
12 instructions="You are a helpful agent.",
13 functions=[get_weather],
14)
15
16messages = [{"role": "user", "content": "What's the weather in NYC?"}]
17
18response = client.run(agent=agent, messages=messages)
19print(response.messages[-1]["content"])