wangold revised this gist . Go to revision
1 file changed, 19 insertions
Swarm-readme-16.py(file created)
@@ -0,0 +1,19 @@ | |||
1 | + | sales_agent = Agent(name="Sales Agent") | |
2 | + | ||
3 | + | def talk_to_sales(): | |
4 | + | print("Hello, World!") | |
5 | + | return Result( | |
6 | + | value="Done", | |
7 | + | agent=sales_agent, | |
8 | + | context_variables={"department": "sales"} | |
9 | + | ) | |
10 | + | ||
11 | + | agent = Agent(functions=[talk_to_sales]) | |
12 | + | ||
13 | + | response = client.run( | |
14 | + | agent=agent, | |
15 | + | messages=[{"role": "user", "content": "Transfer me to sales"}], | |
16 | + | context_variables={"user_name": "John"} | |
17 | + | ) | |
18 | + | print(response.agent.name) | |
19 | + | print(response.context_variables) |
Newer
Older