Share via

How to attach files to code interpreter in new foundry multi-agent workflow

cheng victor 0 Reputation points
2026-02-26T13:40:51.1733333+00:00

Hi everyone,

I am working on using mult-agent worflow in new foudry to perform generate chart and data analysis.


attachments = [MessageAttachment(     file_id=file_id,     tools=[     	CodeInterpreterToolDefinition(),   ], )]

response = openai_client.responses.create(        
	conversation=conversation.id,        
	input="Could you please create bar chart in TRANSPORTATION sector for the operating profit from the uploaded csv file and provide file to me?",		
	attachment = [attachments ],        
	extra_body={"agent_reference": {"name": agent.name, "type": "agent_reference"}},   
 )

However, i am facing a problem that is create function have no parameters of attachment.

Is anyone can provide suggestion on how to upload document (.csv) to multi-agent workflow and the sub-agent ( Data Analysis Agent / Chart Generation Agent) can utilze the document for code Interpreter execution

Packages:

azure-ai-project==2.0.0b4

Cheers

Azure AI Bot Service
Azure AI Bot Service

An Azure service that provides an integrated environment for bot development.


1 answer

Sort by: Most helpful
  1. Karnam Venkata Rajeswari 1,395 Reputation points Microsoft External Staff Moderator
    2026-02-28T18:58:42.63+00:00

    Hello cheng victor,

    Welcome to Microsoft Q&A .Thank you for reaching out with details of your implementation

    As asked for suggestions to upload document (.csv) to multi-agent workflow and the sub-agent and based on the provided code snippet review , here is what’s happening behind the hood –

    1. responses.create does not accept attachment. In Azure AI Foundry (Agents), attachments must be added when creating a message in the conversation, not when creating a response (run).  
    2. Please try using conversations.messages.create to attach the files

    Azure OpenAI in Microsoft Foundry Models REST API preview reference - Microsoft Foundry | Microsoft Learn

    While using responses.create

    1. The API does not include an attachment(s) parameter. It triggers the agent to act on the existing conversation state — it does not modify that state. So ,attachment = [attachments ] is invalid for this API.
    2. Since the snippet attaches the file during responses.create, the file would not exist in the conversation, meaning the sub-agent will not see it.  
    3. The Code Interpreter tool can only access: o   Files attached to a conversation message o   Files already present in the thread context

    Please refer the following:

    Please let me know if you have any questions.

    Thank you!

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.