Skip to content

Commit 57f977d

Browse files
committed
Realtime: add handoff prompt prefix
1 parent 5dc10f3 commit 57f977d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/realtime/app/agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from agents import function_tool
2+
from agents.extensions.handoff_prompt import RECOMMENDED_PROMPT_PREFIX
23
from agents.realtime import RealtimeAgent
34

45
"""
@@ -20,13 +21,13 @@ def get_secret_number() -> int:
2021

2122
haiku_agent = RealtimeAgent(
2223
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+
instructions=f"{RECOMMENDED_PROMPT_PREFIX}.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.",
2425
tools=[],
2526
)
2627

2728
assistant_agent = RealtimeAgent(
2829
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.",
30+
instructions=f"{RECOMMENDED_PROMPT_PREFIX}.If the user wants poetry or haikus, hand off to the haiku agent.",
3031
tools=[get_weather, get_secret_number],
3132
handoffs=[haiku_agent],
3233
)

0 commit comments

Comments
 (0)