Set up the project
Use Python 3.12 or Node.js 22 in a new directory:- Python
- TypeScript
sales.csv:
sales.csv
Upload, analyze, and download
Save the script for your language. Both versions upload the same CSV, run an OpenAI agent with the same instructions, downloadsales-report.md, and delete the session.
- Python
- TypeScript
report.py
sales.csv:
- Python
- TypeScript
sales-report.md should contain North: 150, South: 150, and a grand total of 300. The wording and table layout can vary. Check those numbers against the input before replacing the sample with your own data.
Understand the file paths
The agent reads and writes inside the remote sandbox at/mnt/files/. The files API addresses paths relative to that mount: /sales-report.md downloads the sandbox’s /mnt/files/sales-report.md. save("./sales-report.md") writes the downloaded bytes on your own computer.
The application requests a known output path. If the agent fails to create that file, the download fails too; a successful model response alone doesn’t prove the report exists. The finally block deletes this disposable session even if the run fails. Your downloaded report remains local.
The files API is experimental. For file limits, mount behavior, and the TypeScript equivalents, see remote sandbox files.
Transfer files without an SDK
The model loop belongs to your application, not the Composio REST API. These are the equivalent upload and download operations for an existing session whose sandbox is enabled. Replacesession_id with a session ID you keep alive while your agent works.
Upload the input
- Python
- TypeScript
- API
Download the report
Run this after your agent has written/mnt/files/sales-report.md in that same session.
- Python
- TypeScript
- API