files
Upload files for Bash to use, and download the files it makes. Every file it makes records its task and its conversation, so one call lists everything a conversation produced.
Upload a file
Pass a path, a Blob or bytes, up to 10 MB. Then ask about it.
const traveller = vestra.user('traveller-42'); const ticket = await traveller.files.upload('./ticket.pdf');const run = traveller.ask('Is this ticket refundable?', { attachments: [ticket.id] });await run.text();Download what Bash made
List one conversation's files, or one task's, and download each one.
const made = await vestra.files.list({ conversation: run.conversation! });for (const file of made.data) { const bytes = await vestra.files.download(file.id); console.log(file.filename, bytes.byteLength);}Upload a file
Pass a path, an open file or bytes, up to 10 MB. Then ask about it.
traveller = vestra.user("traveller-42") ticket = traveller.files.upload("ticket.pdf")run = traveller.ask("Is this ticket refundable?", attachments=[ticket.id])run.text()Download what Bash made
List one conversation's files, or one task's, and download each one.
for file in vestra.files.list(conversation=run.conversation).data: print(file.filename, len(vestra.files.download(file.id)))Upload a file
It can be up to 10 MB.
vestra files add ticket.pdf --user traveller-42Download what Bash made
List one conversation's files, and download one into this folder.
vestra files conv_8f2kvestra files get file_2kqUpload a file
Send it for one user as multipart form data, with one part named file, up to 10 MB.
curl "$VESTRA_BASE_URL/v1/files?user_id=traveller-42" \ -H "Authorization: Bearer $VESTRA_API_KEY" \ -F "file=@ticket.pdf"Download what Bash made
List one conversation's files (its tasks' outputs), or one task's.
curl "$VESTRA_BASE_URL/v1/files?conversation_id=conv_8f2k" \ -H "Authorization: Bearer $VESTRA_API_KEY"Get one file
The response has a download link that works for a short while.
curl "$VESTRA_BASE_URL/v1/files/file_2kq" \ -H "Authorization: Bearer $VESTRA_API_KEY"{ "method": "tools/call", "params": { "name": "files", "arguments": { "user": "traveller-42", "conversation": "conv_8f2k" } }}Good to know
Outputs and uploads
A file's source is output if Bash made it, and upload if you uploaded it. Listing by task or conversation returns outputs. Listing by user returns uploads, unless you pass source.
Uploading
POST /v1/files takes multipart form data with one part named file, up to 10 MB. To use the file in an ask, pass its id as an attachment.
Download links
GET /v1/files/{id} returns a download link that works for a short while. To get a fresh link, read the file again.
When Bash makes a file
The file.created event names the new file, on the stream and on your webhooks.
The routes behind files4 routes, each with every field in the API reference
runtime (or all)runtime (or all)