# write_json

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/output/write_json)

Write a JSON envelope to stdout and flush.

The envelope is a single-line JSON object with a stable schema:

```json
{"schema_version": 1, "command": "...", "data": ...}
```

## Signature

```python
write_json(
    command: str,
    data: list | dict,
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `command` | `str` | Yes | Self-documenting command name (e.g. `'list'`, `'threads list'`). |
| `data` | `list \| dict` | Yes | Payload — typically a list for listing commands or a dict for action/info commands.  `default=str` is used so that `Path` and `datetime` objects serialize without error. |

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/0b13f3e0e2726fdb7bbe1e0cf88dac76dbd43b01/libs/cli/deepagents_cli/output.py#L49)