POST /v1/agents/runtime/{runtime_id}/files/list
from gravixlayer import GravixLayer
client = GravixLayer() # defaults to cloud="aws", region="us-east-1"
sandbox = client.runtime.create() # defaults to template="base-small"
listing = sandbox.file.list("/workspace")
for item in listing.files:
kind = "dir" if item.is_dir else "file"
print(f"{item.name} {kind} {item.size} bytes")
if item.permissions:
print(f" {item.permissions}")
sandbox.kill()
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"
const listing = await sandbox.file.list("/workspace");
for (const item of listing.files) {
const kind = item.isDir ? "dir" : "file";
console.log(`${item.name} ${kind} ${item.size} bytes`);
if (item.permissions) {
console.log(` ${item.permissions}`);
}
}
await sandbox.kill();
gravixlayer runtime files ls "$RT" /workspace
curl -X POST "https://api.gravixlayer.ai/v1/agents/runtime/$RT/files/list" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "/workspace"}'
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Directory path |
Response
Each entry inlisting.files:
| Field | Type | Description |
|---|---|---|
name | string | File or directory name |
path | string | Full path when provided by the backend |
size | integer | Size in bytes |
is_dir | boolean | True if directory |
modified_at | string | Last modified timestamp |
mode | string | Octal permission bits |
permissions | string | Human-readable permissions (e.g. rw-r--r--) |