Skip to content

agents.exceptions.UserError: Unhandled item type or structure when use reasoning model with tool call. #1004

Open
@sandsc

Description

@sandsc

When using reasoning model, if first run is a tool call, then agent loop run into next step, there are some reasoning Items in new_item lists.
which causes Unhandled item type error:

 File "site-packages\agents\run.py", line 817, in _run_single_turn_streamed
    async for event in model.stream_response(
  File "site-packages\agents\models\openai_chatcompletions.py", line 155, in stream_response
    response, stream = await self._fetch_response(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages\agents\models\openai_chatcompletions.py", line 227, in _fetch_response
    converted_messages = Converter.items_to_messages(input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages\agents\models\chatcmpl_converter.py", line 447, in items_to_messages
    raise UserError(f"Unhandled item type or structure: {item}")
agents.exceptions.UserError: Unhandled item type or structure: {'id': '__fake_id__', 'summary': [{'text': '', 'type': 'summary_text'}], 'type': 'reasoning'} ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions