Back to catalog / Agent safety
Expose only necessary context to a specialist during handoff
Trim or redact conversation history during handoff to reduce irrelevant and sensitive data exposure.
Goal
Pass only task-relevant information to a specialist and remove unrelated or sensitive content.
Steps
- Identify the fields the specialist needs and mark secrets, credentials, and personal data. [openai-handoffs] [openai-context]
- Use
handoff(agent=..., input_filter=...)withHandoffInputDataand explicitly filterinput_history,pre_handoff_items, andnew_items. [openai-handoffs] [openai-context] - Consider redaction separately for tool arguments, tool results, and ordinary message text; removing structured items alone is insufficient. [openai-handoffs] [openai-context]
- Apply the filter at the handoff boundary while retaining enough information for the specialist. [openai-handoffs] [openai-context]
- Use a test history with fake sensitive strings and verify the specialist receives only allowed fields. [openai-handoffs] [openai-context]
How to verify
Assert fake sensitive markers are absent from specialist input while required task facts remain.
Troubleshooting
If sensitive text remains, inspect ordinary message content and tool results as well as structured tool items.
Permissions
Prerequisites
- Python 3.10+, openai-agents compatible with the pinned revision, and authorized model-provider credentials (except local mock tests)
Permissions
- Use a local or isolated test environment; use least privilege and approval for external data or side effects
Limitations
Filter ordinary messages, tool arguments, and outputs; removing structured tool items or compacting handoff history is not redaction. Server-managed conversations do not support this filter.
Pinned upstream source
- Repository
- openai/openai-agents-python
- File path
- docs/handoffs.md
- Pinned commit
f53c62451c7f34c15f0c87fa745e05404025420f- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Make Agent behavior safer and easier to verify