Metadata-Version: 2.5
Name: mistralai-blokhus
Version: 0.190.0
Summary: Python SDK for Blokhus, Mistral AI's microVM sandbox platform
Author: Mistral AI
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: aiohttp<4,>=3.14.4
Requires-Dist: anyio>=4
Requires-Dist: backports-zstd<2,>=1.6; python_version < '3.14'
Requires-Dist: pydantic>=2
Requires-Dist: websockets<18,>=15
Description-Content-Type: text/markdown

# mistralai-blokhus

Typed async Python client for Blokhus, Mistral AI's microVM sandbox platform.
Commands use HTTP/SSE, files use streamed HTTP, and terminals and port
forwarding use WebSockets. Requires Python 3.12 or later.

## Install

```bash
uv add mistralai-blokhus
```

The import package is `blokhus`.

## Configure

Set the API endpoint and key with `BLOKHUS_API_URL` and `BLOKHUS_API_KEY`
(or `MISTRAL_API_KEY`), or pass `ClientConfig(base_url=..., api_key=...)`.
The key is sent as `Authorization: Bearer <key>`.

## Run a command

```python
import asyncio

from blokhus import Sandbox


async def main() -> None:
    async with await Sandbox.create(image="python:3.12-slim") as sandbox:
        result = await sandbox.commands.exec("printf hello")
        print(result.stdout)
        await sandbox.files.write("/tmp/example.txt", "hello")
        print(await sandbox.files.read("/tmp/example.txt"))


asyncio.run(main())
```
