Skip to content

Python: Bug: GPT-5 Code Interpreter Cannot Access Files from Thread Tool Resources Updated in Semantic Kernel Plugin Filter #13441

@CristinaStn

Description

@CristinaStn

Describe the bug
We have an agent flow where plugin tools return CSV data as a string, then a plugin filter intercepts that CSV, uploads it to Azure OpenAI Files, and updates the thread with the returned file_id under tool_resources so the Code Interpreter tool can access it.
This worked reliably when the agent used GPT-4.1, but after upgrading that agent model to GPT-5, the Code Interpreter session can no longer see/find the uploaded file in the sandbox.
From an enterprise orchestration perspective, an LLM upgrade should not break a stable and correctly wired agent workflow.

To Reproduce

  1. Create an AzureAssistantAgent with Code Interpreter enabled using GPT-5 deployment
  2. Register a Semantic Kernel AutoFunctionInvocationContext filter
  3. In the filter, upload a CSV file to Azure OpenAI Files then update thread tool_resources.code_interpreter.file_ids with the file ID
updated_thread = openai.beta.threads.update(
        thread_id=thread_id, tool_resources=tool_resources  
    )
print(f"Updated thread: {updated_thread}") # Updated thread successfully registered the new tool_resources
  1. Terminate the run with context.terminate = True
  2. Start a conversation asking something that will trigger the filter + plugin execution
  3. Observe: Agent cannot access the file in Code Interpreter
# Code Interpreter:
import os

# List files in the sandbox directory
files = os.listdir('/mnt/data')
filesimport os

paths_to_check = ['/mnt/data', '.']
listing = {}
for p in paths_to_check:
    try:
        listing[p] = os.listdir(p)
    except Exception as e:
        listing[p] = [f'Error: {e}']

listing

Agent response: "I checked the sandbox and it is currently empty (/mnt/data has no files)..."

Expected behavior
To work as of now, as it is already working with GPT-4.1. The agent uses Code Interpreter to load uploaded by as CSV and process it as requested.

Platform

  • Language: Python
  • AI model: GPT-4.1 | GPT-5
  • Environment
    semantic-kernel = 1.29.0
    openai = 1.109.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPull requests for the Python Semantic Kerneltriage

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions