Metadata-Version: 2.4
Name: brynja-agents
Version: 1.6.4
Summary: Sub-millisecond zero-daemon Linux process sandbox provider for Mistral Agents SDK
Author-email: Brynja Team <dev@brynja.dev>
License: MIT
Project-URL: Homepage, https://brynja.dev
Project-URL: Repository, https://github.com/AndybSe/brynja-core
Project-URL: Issues, https://github.com/AndybSe/brynja-core/issues
Keywords: sandbox,landlock,seccomp,linux,process-isolation,ai-agents
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Provides-Extra: mistral
Requires-Dist: mistralai>=1.0.0; extra == "mistral"
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Dynamic: license-file

# `brynja-agents` — Sub-Millisecond Linux Process Sandbox for AI Agents

[![Website: brynja.dev](https://img.shields.io/badge/Website-brynja.dev-00f2fe.svg)](https://brynja.dev)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/AndybSe/brynja-core/blob/main/LICENSE)

Zero-daemon, zero-root Linux process sandbox provider for the **Mistral Agents SDK** (`CustomSandbox`) and autonomous AI workflows, powered by a bundled **~88 KB `#![no_std]` zero-libc Rust binary** using Linux **Landlock LSM**, **Seccomp BPF**, **unprivileged network namespaces**, and **cgroups v2**.

## Install

```bash
pip install brynja-agents
```

Pre-built Linux platform wheels bundle the static `brynja` binary automatically — **no Docker daemon, no Rust toolchain, and no `sudo` required**.

## Quick Start

```python
from brynja_agents import BrynjaSandbox, Network

with BrynjaSandbox(network=Network.none(), memory_limit_mb=256) as sb:
    sb.write_file("hello.py", "print(1 + 1)")
    res = sb.execute("python3 hello.py")
    print(res.stdout)  # "2\n"

    # Sub-5ms Copy-on-Write RL trajectory branching
    branch = sb.fork()
    branch.execute("echo 'isolated mutation' > test.txt")
    branch.close()
```

### Loopback Credential Proxy (Zero Secrets in Sandbox)

```python
sb = BrynjaSandbox(
    network=Network.allow(),
    header_bindings={"api.mistral.ai": {"Authorization": "Bearer YOUR_KEY"}},
)
```

Secrets are injected transparently on the host loopback proxy — never exposed in sandbox environment variables or filesystem.

## Benchmarks (Linux x86_64)

| Metric | Docker | `brynja-agents` |
| :--- | :---: | :---: |
| **Cold Start** | ~2,500 ms | **1.2 ms** (>2,000x faster) |
| **Memory RSS** | ~150 MB | **192 KB** |
| **CoW `fork()` Branch** | Seconds | **2.26 ms** |
| **Bundled Binary** | Daemon + Image | **~88 KB static ELF** |

See [https://brynja.dev](https://brynja.dev) and [`AndybSe/brynja-core`](https://github.com/AndybSe/brynja-core) for full documentation.
