An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
Hi @GenixPRO
What you’re seeing is expected behavior with the Azure AI Foundry Agents Code Interpreter tool.
The Code Interpreter tool runs inside a temporary sandbox container and stores generated files in paths such as:
sandbox:/mnt/data/...
These sandbox files are ephemeral and are automatically removed once the sandbox session expires (typically after a short retention period if the files are not retrieved). Unlike the Assistants API, Azure AI Foundry Agents currently do not provide a persistent file ID that can later be accessed through a Files API.
For production scenarios where users need to revisit generated images, CSVs, charts, or other files from chat history, the recommended approach is to persist the files externally.\
Recommended approach for file persistence
Detect when the agent response includes a sandbox file path
- For example:
sandbox:/mnt/data/output.png
Immediately retrieve the file contents
- This can be done through:
- your backend service
- a follow-up tool execution
- or another workflow that reads the generated file before the sandbox expires
Upload the file to durable storage Examples:
- Azure Blob Storage
- Azure Files
- CDN storage
- your own application storage layer
Store the returned file URL or identifier
- Save the durable URL/file reference in your application database or chat history store.
Surface the persistent URL back to users
- This allows users to access the file later even after the Code Interpreter sandbox is destroyed.
At this time, there is no built-in setting in Azure AI Foundry Agents to automatically persist sandbox-generated files for long-term storage.
If durable retention is required, downloading and re-uploading the generated files to your own storage is the recommended pattern.
Difference from Assistants API
With the Assistants API:
- Generated files can be associated with persistent file IDs
- Files can later be retrieved using the Files API
With Azure AI Foundry Agents:
- Sandbox files are temporary
- No durable Files API access currently exists for sandbox-generated artifacts
References
- Code Interpreter in Azure AI Foundry Agents
- Code Interpreter file downloads in Azure OpenAI Assistants API
I hope this helps clarify the behavior and recommended architecture pattern. If needed, please share more details about your storage architecture or application flow, and the community can help suggest a more specific implementation approach.
Thank you!