Files are working state
Files live in an environment. A session without an environment has no filesystem. For hosted compute, supply files in environment.files using a Files API file ID or inline base64 data and a workspace path. Check current upload limits in the official reference.
Artifacts are published outputs
For OpenAI-hosted compute, ask the agent to write deliverables under /workspace/outputs. Completed turns publish immutable artifacts. Match both turn ID and path when retrieving a result so an earlier version is not mistaken for the latest output.
Self-hosted file retrieval differs
Self-hosted files are retrieved through your provider or mounted filesystem, not the hosted Artifacts API. Copy results into application storage before shutting down or expiring the environment.
Retention and deletion
Published artifacts survive environment expiration, but save anything you need before deleting the session. Deleting an artifact does not remove the environment file. For several downloads, request each artifact or ask the agent to create a ZIP output.
Read the official reference
Check the source for current API fields, account requirements, and service limits.
OpenAI: files