Skip to content

Citation annotations missing when using structured output #2051

@mserek

Description

@mserek

Is it possible to get citation annotations when using structured output?

With the following conifig:

research_agent = Agent(
        name="Agent",
        model="gpt-5-2025-08-07",
        model_settings=ModelSettings(response_include=['web_search_call.action.sources', 'web_search_call.results']),
        instructions='...',
        tools=[WebSearchTool()],
    )

I can get annotations in the response content=[ResponseOutputText(annotations=[AnnotationURLCitation(end_index=516, start_index=344, title='...', type='url_citation', url='https...'), ...], text='response')]
When using structured outputs i.e. providing output_type to be a pydantic model, the annotations list is empty and the text contains citation artifacts like \ue200cite\ue202turn1search0\ue201 or \ue200cite\ue202turn0news14\ue201". Can i somehow get regular citation annotations or map the artifacts in the web search tool results?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions