You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the UI example locally, you can edit this file to change the setup. THe server
6
+
will use the agent returned from get_starting_agent() as the starting agent."""
7
+
8
+
9
+
@function_tool
10
+
defget_weather(city: str) ->str:
11
+
"""Get the weather in a city."""
12
+
returnf"The weather in {city} is sunny."
13
+
14
+
15
+
@function_tool
16
+
defget_secret_number() ->int:
17
+
"""Returns the secret number, if the user asks for it."""
18
+
return71
19
+
20
+
21
+
haiku_agent=RealtimeAgent(
22
+
name="Haiku Agent",
23
+
instructions="You are a haiku poet. You must respond ONLY in traditional haiku format (5-7-5 syllables). Every response should be a proper haiku about the topic. Do not break character.",
24
+
tools=[],
25
+
)
26
+
27
+
assistant_agent=RealtimeAgent(
28
+
name="Assistant",
29
+
instructions="If the user wants poetry or haikus, you can hand them off to the haiku agent via the transfer_to_haiku_agent tool.",
# Import TwilioHandler class - handle both module and package use cases
16
+
ifTYPE_CHECKING:
17
+
# For type checking, use the relative import
18
+
from .agentimportget_starting_agent
19
+
else:
20
+
# At runtime, try both import styles
21
+
try:
22
+
# Try relative import first (when used as a package)
23
+
from .agentimportget_starting_agent
24
+
exceptImportError:
25
+
# Fall back to direct import (when run as a script)
26
+
fromagentimportget_starting_agent
31
27
32
-
haiku_agent=RealtimeAgent(
33
-
name="Haiku Agent",
34
-
instructions="You are a haiku poet. You must respond ONLY in traditional haiku format (5-7-5 syllables). Every response should be a proper haiku about the topic. Do not break character.",
35
-
tools=[],
36
-
)
37
28
38
-
agent=RealtimeAgent(
39
-
name="Assistant",
40
-
instructions="If the user wants poetry or haikus, you can hand them off to the haiku agent via the transfer_to_haiku_agent tool.",
0 commit comments