diff --git a/src/agents/extensions/handoff_prompt.py b/src/agents/extensions/handoff_prompt.py index cfb5ca7ec..2f3b3ef00 100644 --- a/src/agents/extensions/handoff_prompt.py +++ b/src/agents/extensions/handoff_prompt.py @@ -16,4 +16,7 @@ def prompt_with_handoff_instructions(prompt: str) -> str: """ Add recommended instructions to the prompt for agents that use handoffs. """ + if not isinstance(prompt, str): + raise TypeError(f"prompt must be a string, got {type(prompt).__name__}") + return f"{RECOMMENDED_PROMPT_PREFIX}\n\n{prompt}"