Agent handoff patterns with message filtering in Temporal workflows.
Adapted from OpenAI Agents SDK handoffs examples
Before running these examples, be sure to review the prerequisites and background on the integration.
First, start the worker:
uv run openai_agents/handoffs/run_worker.pyThen run the workflow:
Demonstrates agent handoffs with message history filtering:
uv run openai_agents/handoffs/run_message_filter_workflow.pyThe workflow demonstrates a 4-step conversation with message filtering:
- Introduction: User greets first agent with name
- Tool Usage: First agent generates random number using function tool
- Agent Switch: Conversation moves to second agent for general questions
- Spanish Handoff: Second agent detects Spanish and hands off to Spanish specialist
During the Spanish handoff, message filtering occurs:
- All tool-related messages are removed from history
- First two messages are dropped (demonstration of selective context)
- Filtered conversation continues with Spanish agent
The workflow returns both the final response and complete message history for inspection.
The following patterns from the reference repository are not included in this Temporal adaptation:
- Message Filter Streaming: Streaming capabilities are not yet available in the Temporal integration