Skip to content

session.updateHistory doesn't support audio turns #963

@josephtannenbaum

Description

@josephtannenbaum

Please read this first

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

Describe the bug

I'm trying to store a realtime conversation while it's in progress, and restore it later. When I access session.history, I get RealtimeItems that look like this:

[{
      itemId: 'item_123',
      type: 'message',
      role: 'assistant',
      status: 'completed',
      content: [
        {
          type: 'output_audio',
          transcript: 'Thanks for calling. How can I help?',
          audio: null,
        },
      ],
    }]

When I try to load this with session.updateHistory, I get the following error:

 Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
   type: 'error',
   error: {
     type: 'error',
     event_id: 'event_D8sDiiDisPUHKG1YVD3Cl',
     error: {
       type: 'invalid_request_error',
       code: 'missing_required_parameter',
       message: "Missing required parameter: 'item.content[0].text'.",
       param: 'item.content[0].text',
       event_id: null
     }
   }
 })

Debug information

  • Agents SDK version: v0.4.8
  • Runtime environment Node.js v22.20.0

Repro steps

    const myItem = {
      itemId: 'item_123',
      type: 'message' as const,
      role: 'assistant' as const,
      status: 'completed' as const,
      content: [
        {
          type: 'output_audio' as const,
          transcript: 'Thanks for calling. How can I help?',
          audio: null,
        },
      ],
    };
    session.updateHistory([myItem]);

Expected behavior

I'd like to be able to restore a conversation with the exact data structures in session.history (function calls aside)

In the meantime, if anyone knows what format updateHistory accepts, that would be a great workaround

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions