> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gravixlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Write File

> Write text content to files in an agent runtime

```python theme={null}
from gravixlayer import GravixLayer

client = GravixLayer()
runtime = client.runtime.create(template="python-3.14-base-small")

runtime.file.write(
    "/workspace/hello.txt",
    "Hello from Gravix Layer\n",
)

# Read it back
result = runtime.file.read("/workspace/hello.txt")
print(result.content)

runtime.kill()
```

## Parameters

| Parameter | Type   | Required | Description           |
| --------- | ------ | -------- | --------------------- |
| `path`    | string | Yes      | Destination file path |
| `content` | string | Yes      | File content          |

## Response

| Field           | Type    | Description             |
| --------------- | ------- | ----------------------- |
| `message`       | string  | Confirmation message    |
| `path`          | string  | Written file path       |
| `bytes_written` | integer | Number of bytes written |

## Batch Write

Write multiple files in a single call:

```python theme={null}
from gravixlayer import GravixLayer, WriteEntry

client = GravixLayer()
runtime = client.runtime.create(template="python-3.14-base-small")

result = runtime.file.write_many(
    [
        WriteEntry(path="/workspace/a.txt", data="File A\n"),
        WriteEntry(path="/workspace/b.txt", data="File B\n"),
    ],
)

for f in result.files:
    print(f.path, f.size)

runtime.kill()
```
