-
Notifications
You must be signed in to change notification settings - Fork 317
Expand file tree
/
Copy path19_agents_handsoff.py
More file actions
34 lines (28 loc) · 851 Bytes
/
19_agents_handsoff.py
File metadata and controls
34 lines (28 loc) · 851 Bytes
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
# import os
from agents import Agent, Runner
from dotenv import load_dotenv
load_dotenv()
german_agent = Agent(
name="German Assistant",
instructions="Always respond in German. Be polite and concise.",
)
english_agent = Agent(
name="English Assistant",
instructions="Always respond in English.",
)
customer_service_manager = Agent(
name="Customer Service Manager",
instructions="Handoff to the appropriate agent based on the language of the request.",
handoffs=[german_agent, english_agent],
)
async def main():
query = "Hallo, ich habe ein Problem und muss mit dem Manager sprechen"
result = await Runner.run(
customer_service_manager,
query
)
print(f"👧: {query}")
print(f"🤖: {result.final_output}")
if __name__ == "__main__":
import asyncio
asyncio.run(main())