Skip to content

Uploading a CSV file for use with the code interpreter tool fails #2376

@Soremwar

Description

@Soremwar

Please read this first

  • Have you read the docs? Yes, they don't mention whether this is possible or not
  • Have you searched for related issues? Yes

Describe the bug

Returning a ToolOutputFileContent from a tool fails with the error openai.BadRequestError: Error code: 400 - {'error': {'message': 'The file type you uploaded is not supported. Please try again with a PDF', 'type': 'invalid_request_error', 'param': 'input', 'code': 'unsupported_file'}}. This was attempted with a CSV file, which should be supported according to https://platform.openai.com/docs/guides/tools-code-interpreter#supported-files

Granted, this seems to apply to directly interfacing with code interpreter in the API, but my tool is CodeInterpreter enabled in the following way

AGENT = Agent(
	name="My agent",
	model="gpt-5.1",
	tools=[
		CodeInterpreterTool({
			"type": "code_interpreter",
			"container": {
				"type": "auto",
			},
		}),
	],
)

Debug information

  • Agents SDK version: 0.7.0
  • Python version: 3.12.9

Repro steps

from agents import Agent, CodeInterpreterTool, function_tool, ToolOutputFileContent
import base64

@function_tool
def get_data() -> str | ToolOutputFileContent:
	parsed_data = "COL_1,COL_2\n1,2\n3,4"
	encoded_data = "data:text/csv;base64," + base64.b64encode(parsed_data.encode("utf-8")).decode("utf-8")
	return ToolOutputFileContent(file_data=encoded_data, filename="data.csv")

AGENT = Agent(
	name="My agent",
	model="gpt-5.1",
	tools=[
		get_data,
		CodeInterpreterTool({
			"type": "code_interpreter",
			"container": {
				"type": "auto",
			},
		}),
	],
)

Expected behavior

The agent should orchestrate passing the files to the code interpreter

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDKstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions