Skip to content

HandoffCallItem event is missing in v0.2.11 #1712

@goooodle

Description

@goooodle

Please read this first

  • Have you read the docs?Agents SDK docs
  • Have you searched for related issues? Others may have faced similar issues.

Yes

Describe the bug

code:

def handoff_message_filter(handoff_input_data: HandoffInputData) -> HandoffInputData:
    handoff_message_data = remove_handoff_tools(handoff_input_data)
    return HandoffInputData(
        input_history=handoff_input_data.input_history,
        pre_handoff_items=tuple(handoff_message_data.pre_handoff_items),
        new_items=tuple(handoff_message_data.new_items),
    )

# === remove HandoffCallItem and HandoffOutputItem 
def _remove_tools_from_items(items: tuple[RunItem, ...]) -> tuple[RunItem, ...]:
    filtered_items = []
    for item in items:
        if (
                isinstance(item, HandoffCallItem)
                or isinstance(item, HandoffOutputItem)
        ):
            continue
        filtered_items.append(item)
    return tuple(filtered_items)


agent = Agent(
        name='test',
        instructions=instructions
    )

  agent.handoffs = [handoff(
        agent= test2,
        tool_name_override=tool_key,
        tool_description_override=tool_description,
        input_filter=handoff_message_filter
    )]


agent_result = Runner.run_streamed(
            starting_agent=agent,
            input='xxx',
        )

async for event in agent_result.stream_events():
  if isinstance(event.item, HandoffCallItem):
     # ===  HandoffCallItem missing
     pass

HandoffCallItem is missing.
It might be caused by adding input_filter=handoff_message_filter in agent.handoffs.
Agents SDK v0.2.9 is good, but v0.2.11 is not

Debug information

  • Agents SDK version: (e.g. v0.0.3)
    v0.2.11
  • Python version (e.g. Python 3.10)
    3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions