GET /v1/agents/runtime/{runtime_id}/download?path=...
from gravixlayer import GravixLayer
client = GravixLayer() # defaults to cloud="aws", region="us-east-1"
sandbox = client.runtime.create() # defaults to template="base-small"
# Create a file in the sandbox so we have something to download
sandbox.file.write("/workspace/report.csv", "id,name\n1,alpha\n2,beta\n")
# Download file as raw bytes
content = sandbox.file.download_file("/workspace/report.csv")
with open("./report.csv", "wb") as f:
f.write(content)
sandbox.kill()
import { writeFile } from 'node:fs/promises';
import { GravixLayer } from 'gravixlayer';
const client = new GravixLayer(); // defaults to cloud="aws", region="us-east-1"
const sandbox = await client.runtime.create(); // defaults to template="base-small"
await sandbox.file.write('/workspace/report.csv', 'id,name\n1,alpha\n2,beta\n');
const content = await sandbox.file.download('/workspace/report.csv');
await writeFile('./report.csv', content);
await sandbox.kill();
gravixlayer runtime files download "$RT" /workspace/out.bin ./out.bin
curl -X GET "https://api.gravixlayer.ai/v1/agents/runtime/$RT/download?path=/workspace/out.bin" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-o ./out.bin
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path inside the runtime |
Response
Returns rawbytes. Write directly to a local file.