Hey @_j - thanks for your reply.
I think what you are describing is the idea of accessing generated files as annotation property of the output. I am aware that there are problems of this property being sometimes empty, and that I should instruct model to generate markdown output links (I saw your response in O3 / o4-mini unable to output files with Code Interpreter tool thread).
The problem is when agent has access to additional tools and they are called immediately after using call interpreter tool. Then the annotation list will be empty anyway.
Because of that Iāve decided to equip agent with share_file_with_user tool which accepts file_name as input. It works like this:
- agent calls
share_file_with_user providing file_name (/mnt/data/xxxx)
- Tool is using container api to list files in the container
- Then it compares provided name with container files paths
- If the file is found (name is matching the path)
https://api.openai.com/v1/containers/{container_id}/files/{file_id}/content is called and the file content is saved in my external storage + it is added as attachement to agent response. Otherwise agent is informed that the file couldnāt be find and he responds appropiately.
Now, this solution works very well in a way that it is independent of annotation property being populated or empty (I am simply ignoring this property). After using code_interpreter tool agent knows that he should use share_file_with_user and it provides file names in the same form they were used in executed python code. The problem is that sometimes container files have path property corrupted, like in the examples Iāve provided. Then the tool is not able to find the files and it is also not able to download its content.
Example:
(corrupted path) "path": "ls: cannot access '/mnt/data/*': No such file or directory",
or
(multiple paths concatenated as one) "path": "/mnt/data/precipitation_bar_chart.png /mnt/data/temperature_line_chart.png",
Another example:
container files list after run:
[
{
"id": "cfile_687754c6ac108191816966120a7da3c4",
"bytes": null,
"container_id": "cntr_687754ae04688191b2467b9622f496d801f90aa75b18f351",
"created_at": 1752650950,
"object": "container.file",
"path": "/mnt/data/forecast_Lublin.png /mnt/data/forecast_WrocÅaw.png",
"source": "assistant"
},
{
"id": "cfile_687754c6abf88191936785bf88d4c6c5",
"bytes": null,
"container_id": "cntr_687754ae04688191b2467b9622f496d801f90aa75b18f351",
"created_at": 1752650950,
"object": "container.file",
"path": "/mnt/data/forecast_Kraków.png /mnt/data/forecast_Warsaw.png",
"source": "assistant"
},
{
"id": "cfile_687754c6abd88191a579b353355c5d0a",
"bytes": null,
"container_id": "cntr_687754ae04688191b2467b9622f496d801f90aa75b18f351",
"created_at": 1752650950,
"object": "container.file",
"path": "/mnt/data/forecast_GdaÅsk.png /mnt/data/forecast_PoznaÅ.png",
"source": "assistant"
}
]
calling https://api.openai.com/v1/containers/{container_id}/files/{file_id}/content
with container_id=cntr_687754ae04688191b2467b9622f496d801f90aa75b18f351 and file_id=cfile_687754c6abf88191936785bf88d4c6c5 - got response:
File cfile_687754c6abf88191936785bf88d4c6c5 not found on container cntr_687754ae04688191b2467b9622f496d801f90aa75b18f351. This is invalid as you can see this file id being returned in container list files operation.
Do you know what could be the cause of this issue?
I think your response targets issue with not returning annotations in api response, while I am currently having issue with container files being created in corrupted form. Maybe it is connected, although without knowing how container files are being created and added to the container we cannot find a way to improve this by prompt.