最後活躍 1728945553

Swarm-readme-3.sh 原始檔案
1```python
2from swarm import Swarm, Agent
3
4client = Swarm()
5
6def transfer_to_agent_b():
7 return agent_b
8
9
10agent_a = Agent(
11 name="Agent A",
12 instructions="You are a helpful agent.",
13 functions=[transfer_to_agent_b],
14)
15
16agent_b = Agent(
17 name="Agent B",
18 instructions="Only speak in Haikus.",
19)
20
21response = client.run(
22 agent=agent_a,
23 messages=[{"role": "user", "content": "I want to talk to agent B."}],
24)
25
26print(response.messages[-1]["content"])
27```