---
type: email
from: Abdul Samad Siddiqui <notifications@github.com>
subject: [openai/openai-agents-python] Add type validation to

 prompt_with_handoff_instructions function (PR #1885)
received: 2026-03-06 08:01:55
date_header: Sun, 12 Oct 2025 12:32:13 -0700
priority: normal
status: awaiting_approval
uid: 32382
---

## Email Content

**From:** Abdul Samad Siddiqui <notifications@github.com>
**Subject:** [openai/openai-agents-python] Add type validation to

 prompt_with_handoff_instructions function (PR #1885)
**Date:** Sun, 12 Oct 2025 12:32:13 -0700

### Body (preview)

## Summary



This PR adds runtime type validation to the `prompt_with_handoff_instructions` function to ensure it only accepts string inputs. Previously, the function had a type hint but no runtime validation, so passing non-string types did **not raise any error**, which could lead to unexpected behavior or silent failures.



## Changes



* Added `isinstance(prompt, str)` check in `prompt_with_handoff_instructions`

* Raises `TypeError` with descriptive message when non-string types are provided

* Updated function docstring to document the new validation and exception



## Testing



The validation has been tested with various input types:



* Valid strings: Work as expected

* Invalid types (int, list, None, etc.): Previously caused silent failures, now properly raise `TypeError` with a clear message



You can view, comment on, or merge this pull request online at:



  https://github.com/openai/openai-agents-python/pull/1885



-- Commit Summary --



  * Add type validation to prompt_with_handoff_instructions



-- File Changes --



    M src/agents/extensions/handoff_prompt.py (12)



-- Patch Links --



https://github.com/openai/openai-agents-python/pull/1885.patch

https://github.com/openai/openai-agents-python/pull/1885.diff



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1885

You are receiving this because you are subscribed to this thread.



Message ID: &lt;openai/openai-agents-python/pull/1885@github.com&gt;

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
