Skip to content

Python: [Bug]: Responses hosting rejects input_file with file_data, which OpenAIChatClient sends for local files #10283

Closed

Description

@nniiovoo

Observed Behavior

responses_to_run only accepts input_file parts with file_url or file_id. A part with inline file_data raises ValueError.

OpenAIChatClient sends exactly that for Content.from_data(pdf_bytes, "application/pdf"): {"type": "input_file", "file_data": "data:application/pdf;base64,..."}. So an agent hosted with agent-framework-hosting-responses can't receive a local file from Agent Framework's own OpenAI client. I checked this end to end with OpenAIChatClient pointed at a small FastAPI app that calls responses_to_run: text works, text plus a PDF fails.

Expected Behavior

file_data is accepted like the other two forms (the Responses API allows file_id, file_url, or file_data) and becomes data content.

Steps to Reproduce

  1. Build a Responses request with an input_file part that uses file_data
  2. Pass it to responses_to_run

Minimal Reproduction

import base64

from agent_framework_hosting_responses import responses_to_run

pdf = base64.b64encode(b"%PDF-1.4\n").decode()

# What OpenAIChatClient sends for Content.from_data(pdf_bytes, "application/pdf").
body = {
    "input": [
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Summarize this file"},
                {"type": "input_file", "file_data": f"data:application/pdf;base64,{pdf}"},
            ],
        }
    ]
}

run = responses_to_run(body)
print([content.type for content in run["messages"][0].contents])

Error Messages and Stack Traces

  File ".../agent_framework_hosting_responses/_parsing.py", line 211, in _content_from_input_item
    raise ValueError("input_file requires a non-empty string `file_url` or `file_id`")
ValueError: input_file requires a non-empty string `file_url` or `file_id`

Package Versions

agent-framework-core 1.25.0, agent-framework-hosting-responses 1.0.0a261106, agent-framework-openai 1.18.1 (main at 22b5e75), openai 3.36.1

Python Version

Python 3.12

Operating System

macOS

Regression

No

Additional Context

_content_from_input_item in _parsing.py has branches for file_url and file_id only. A fix could be to add a file_data branch that turns the data URI into data content. I have a fix with tests and will open a PR.

AI assistance: I used an AI assistant to help find the cause and write this up. I ran the repro myself.

Acknowledgements

  • I searched existing issues and did not find a duplicate.
  • I personally verified this behavior and the reproduction details are authentic.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Nov 11, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Nov 11, 2026
  3. github-actions commented on Nov 11, 2026

    @github-actions
    Contributor

    Reproduced on main (22b5e75) with the minimal snippet from the report: responses_to_run raises ValueError: input_file requires a non-empty string file_url or file_id at _parsing.py:211 for an input_file with file_data. Routed to the hosting-responses owner. Support boundary: unclear from maintained docs, so scope is for a maintainer to decide. Open PR #10284 targets this. Run: https://github.com/microsoft/agent-framework/actions/runs/43113596535

    Generated by Issue Routing for #10283 · copilot · auto · ~19 AIC · ⌖ ~1 AIC · ⊞ 5.2K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: Pythonready-for-implementationMaintainers agree the problem and direction are ready for implementation.reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowtriageUsage: [Issues], Target: All issues that still need to be triaged

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions