Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
57f9b70
refactor: core sandbox infra to use openenv.core.harness.sandbox
rycerzes May 12, 2026
024e904
feat: CLIAgentDriver Abstraction
rycerzes May 12, 2026
455b0e9
feat: add tests
rycerzes May 12, 2026
e97fda0
feat: impl Docker sandbox backend
rycerzes May 13, 2026
9a35006
feat: pi agent adapter
rycerzes May 13, 2026
06df791
chore: agent specifications and improve interception module ref
rycerzes May 14, 2026
a3c4a3d
feat: add tests for opencode + pi harness adapters
rycerzes May 14, 2026
81e37a2
chore: migrate opencode_env to coding_agent_env
rycerzes May 14, 2026
ddf1313
feat: hf sandbox backend
rycerzes May 14, 2026
9d85640
chore: ruff + usort format pass
rycerzes May 15, 2026
2f9435c
refactor: remove transparent_proxy mode and in-sandbox interception p…
rycerzes May 15, 2026
71bd9e9
feat: InterceptionServer + interception_gate mode for trainer-owned g…
rycerzes May 15, 2026
171a3ea
refactor: wire coding_agent_env with interception_gate
rycerzes May 15, 2026
52a024e
chore: update tests for interception_gate, remove proxy test cases
rycerzes May 15, 2026
4b1b707
chore: address greptile review comments
rycerzes May 15, 2026
8830b72
feat: task adapter + mini subset builder
rycerzes May 15, 2026
6c4caa4
feat: mini_swe_env impl
rycerzes May 16, 2026
4b115a8
refactor: task adapter
rycerzes May 16, 2026
afb9bd9
feat: SWE-Gym task model and loader
rycerzes May 16, 2026
8d3b79f
feat: integrate pi agent harness
rycerzes May 16, 2026
a478fa8
refactor: extract sandbox bootstrap to driver and fix interception races
rycerzes May 16, 2026
b18caf2
chore: remove unsupported mode checks from CodingAgentEnvironment
rycerzes May 16, 2026
bfc7305
chore: revert linting for out of scope files
rycerzes May 16, 2026
c2ca0c8
feat: host-side tool routing and Pi gate models bootstrap
rycerzes May 16, 2026
1b1d9fb
fix: support configurable Pi workdir for command and MCP config
rycerzes May 16, 2026
2f52e48
fix: Docker host gateway mapping and per-create image override
rycerzes May 16, 2026
f3fede2
feat: configurable extension directory support for CLI agents
rycerzes May 16, 2026
9bdee17
refactor: harness and models for host-side grading
rycerzes May 16, 2026
d14cac4
Merge remote-tracking branch 'fork/feat/multi-harness' into feat/mini…
rycerzes May 16, 2026
341c387
refactor: SWE-Gym grading to use native test outcomes
rycerzes May 16, 2026
b6e295e
feat: update default task index to known easy task
rycerzes May 17, 2026
42fd066
feat: impl control-plane primitives and entrypoint
rycerzes May 17, 2026
66026e8
feat: async rollout processing
rycerzes May 17, 2026
01a1dc3
feat: answer tracking and reward source management
rycerzes May 17, 2026
5a4e93d
feat: Async GRPO training with Pi agent and InterceptionServer
rycerzes May 17, 2026
6502362
chore: use trackio
rycerzes May 17, 2026
6e59c96
feat: Dockerfile, README, and start script
rycerzes May 17, 2026
d556081
fix: bg threading for async control plane
rycerzes May 17, 2026
448f690
fix: thread-safe queue handling
rycerzes May 18, 2026
37e549d
fix: interception gate support in CodingAgentSessionFactory
rycerzes May 18, 2026
8aa9d18
fix: improve error handling and config propagation across agent pipeline
rycerzes May 18, 2026
61e5524
fix: whitespace secret validation + conditional /root/ write
rycerzes May 18, 2026
a2b4388
fix: cross-loop safe request queue via stdlib queue.Queue
rycerzes May 18, 2026
de5cdc6
Merge remote-tracking branch 'fork/feat/multi-harness' into feat/mini…
rycerzes May 18, 2026
4bcb2fd
feat: NCCL weight transfer and response parsing
rycerzes May 18, 2026
f9c8573
chore: pin vLLM to 0.18.1 and update installation process in Dockerfile
rycerzes May 18, 2026
254f32a
refactor: replace asyncio.Queue with queue.Queue for interception que…
rycerzes May 18, 2026
f8d984b
feat: checkpointing
rycerzes May 18, 2026
b10a448
fix: replace asyncio.Queue with queue.Queue for thread-safe request h…
rycerzes May 18, 2026
659288b
fix: pi config discovery for CLIAgentDriver to be independent of runt…
rycerzes May 18, 2026
1eefe64
Merge branch 'feat/multi-harness' of https://github.com/rycerzes/open…
rycerzes May 18, 2026
500413a
feat: bitsandbytes training params
rycerzes May 18, 2026
1756908
feat: deploy script for SWE Async GRPO training to HF Space
rycerzes May 18, 2026
5136337
fix: interception params and update max_tokens_cap validation
rycerzes May 20, 2026
8137b15
refactor: remove RolloutTurn references
rycerzes May 20, 2026
3c4ffa4
feat: add tool name allowlist validation
rycerzes May 20, 2026
151d1ab
feat: provider-specific env var handling for Pi agent
rycerzes May 20, 2026
93c13f7
Merge remote-tracking branch 'fork/feat/multi-harness' into feat/mini…
rycerzes May 20, 2026
73bb3a6
feat: tool name allowlist to InterceptionServer init
rycerzes May 20, 2026
cf15c8b
refactor(mini_swe): move async_grpo training stack from env package
rycerzes May 20, 2026
42419d6
fix(pi): use Node.js 22.x
rycerzes May 23, 2026
9e61e76
fix: env handling in deployment scripts
rycerzes May 23, 2026
c3228f7
chore: update vLLM version to 0.21.0 and adjust weight lifecycle mana…
rycerzes May 23, 2026
9396bf6
feat: traj collection
rycerzes May 24, 2026
cc6dacd
chore: rm mention of cf
rycerzes May 25, 2026
4e8c4b0
fix: trajectory persistence and periodic uploads
rycerzes May 25, 2026
131edf3
fix: rollout handling
rycerzes May 25, 2026
afc6c79
feat: per-turn completion records for RL reconstruction
rycerzes May 29, 2026
d0659e2
feat: post-hoc grading & evaluation
rycerzes May 29, 2026
b9ca3b1
fix: allow unlimited agent turns
rycerzes May 29, 2026
212dd47
fix: group-relative advantage with num_generations parameter
rycerzes May 29, 2026
9e3c3a7
fix: update vLLM weight prefix handling for Qwen3.5 models
rycerzes May 29, 2026
49765f7
fix: add num_generations parameter to deploy_hf_space.sh
rycerzes May 29, 2026
a1a764d
fix: strip cf from the name
rycerzes May 29, 2026
f4ab810
fix: chat template prefix handling for multi-turn tool use
rycerzes May 29, 2026
6c9e121
chore: clarify RolloutSample docstring regarding TRL's reward functions
rycerzes May 29, 2026
74acb44
refactor: ctx overflow handling and model length config in rollout wo…
rycerzes May 30, 2026
2a90f47
fix: grading, context management and message truncation
rycerzes May 30, 2026
57e89ea
feat: LoRA config with multi GPU
rycerzes May 30, 2026
a0ab2e8
fix: fsdp2, adamw_torch and flash-linear-attn
rycerzes May 31, 2026
c540b02
chore: updated training parameters for SWE Async GRPO
rycerzes May 31, 2026
38482cd
chore: detection for running in HF Space and handle pausing logic
rycerzes Jun 1, 2026
c6612b3
refactor: loss_mask/prefix-merging fix
rycerzes Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/source/environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,13 @@ AgentWorldModel-1K — 1,000 synthetic MCP tool-use environments with 10,000 tas
```
````

````{grid-item-card} Opencode
````{grid-item-card} Coding Agent
:class-card: sd-border-1

`opencode_env` runs the OpenCode coding agent inside an isolated E2B sandbox against any OpenAI-compatible LLM endpoint, optionally capturing per-token logpr...
`coding_agent_env` runs coding-agent harnesses (currently OpenCode + Pi) inside an isolated E2B sandbox against any OpenAI-compatible LLM endpoint, optionally capturing per-token logpr...

+++
```{button-link} environments/opencode.html
```{button-link} environments/coding_agent.html
:color: primary
:outline:

Expand Down Expand Up @@ -633,5 +633,5 @@ environments/tbench2
environments/unity
environments/wildfire
environments/agent_world_model
environments/opencode
environments/coding_agent
```
2 changes: 2 additions & 0 deletions docs/source/environments/coding_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../../../envs/coding_agent_env/README.md
```
2 changes: 0 additions & 2 deletions docs/source/environments/opencode.md

This file was deleted.

File renamed without changes.
File renamed without changes.
128 changes: 65 additions & 63 deletions envs/opencode_env/README.md → envs/coding_agent_env/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: OpenCode Environment Server
title: Coding Agent Environment Server
emoji: 🛠️
colorFrom: indigo
colorTo: purple
Expand All @@ -9,23 +9,24 @@ app_port: 8000
base_path: /web
tags:
- openenv
short_description: OpenCode coding agent in an E2B sandbox with logprob capture
short_description: Multi-harness coding-agent env (OpenCode + Pi) in E2B
---

# OpenCode Environment for OpenEnv
# Coding Agent Environment for OpenEnv

`opencode_env` runs the [OpenCode](https://opencode.ai) coding agent inside
an isolated [E2B](https://e2b.dev) sandbox against any OpenAI-compatible
LLM endpoint, optionally capturing per-token logprobs for GRPO training.
`coding_agent_env` runs coding-agent harnesses (currently
[OpenCode](https://opencode.ai) and [Pi](https://github.com/badlogic/pi-mono))
inside an isolated [E2B](https://e2b.dev) sandbox against any OpenAI-compatible
LLM endpoint with optional trainer-owned interception for RL training.

**🚀 Try it live**: [`AdithyaSK/opencode-env`](https://huggingface.co/spaces/AdithyaSK/opencode-env)
**🚀 Try it live**: [`AdithyaSK/coding-agent-env`](https://huggingface.co/spaces/AdithyaSK/coding-agent-env)

The deployed Space exposes:

- **Web UI** at [`/web`](https://adithyask-opencode-env.hf.space/web) — pick endpoint, write task, hit Run, watch live phase log + reward + logprobs.
- **MCP tool API** at [`/mcp`](https://adithyask-opencode-env.hf.space/mcp) — programmatic `run_rollout` calls.
- **OpenAPI docs** at [`/docs`](https://adithyask-opencode-env.hf.space/docs).
- **Health** at [`/health`](https://adithyask-opencode-env.hf.space/health).
- **Web UI** at [`/web`](https://adithyask-coding-agent-env.hf.space/web) — pick endpoint, write task, hit Run, watch live phase log + reward.
- **MCP tool API** at [`/mcp`](https://adithyask-coding-agent-env.hf.space/mcp) — programmatic `run_rollout` calls.
- **OpenAPI docs** at [`/docs`](https://adithyask-coding-agent-env.hf.space/docs).
- **Health** at [`/health`](https://adithyask-coding-agent-env.hf.space/health).

The env is **task-agnostic** — every rollout is configured at call-time
with a uniform Task shape:
Expand All @@ -47,20 +48,21 @@ a float to `/home/user/logs/verifier/reward.txt` (override).
```python
import asyncio
import os
from opencode_env import OpenCodeEnv
from opencode_env.client import _extract_text
from opencode_env.models import RolloutResult
from coding_agent_env import CodingAgentEnv
from coding_agent_env.client import _extract_text
from coding_agent_env.models import RolloutResult


async def main():
SPACE = "https://adithyask-opencode-env.hf.space"
SPACE = "https://adithyask-coding-agent-env.hf.space"

async with OpenCodeEnv(base_url=SPACE) as env:
async with CodingAgentEnv(base_url=SPACE) as env:
await env.reset()

# The MCP tool returns JSON; deserialize via the typed model.
raw = await env.call_tool(
"run_rollout",
agent="opencode", # opencode | pi
endpoint="openai", # vllm | openai | hf_router
api_key=os.environ["OPENAI_API_KEY"], # or set as a Space secret
instruction=(
Expand All @@ -75,13 +77,12 @@ async def main():
"import binary_search; "
"assert binary_search.binary_search([1,2,3], 2) == 1; print('OK')\"",
],
template="opencode-rl", # prebaked E2B template
template="coding-agent-rl", # prebaked E2B template
task_id="binary_search_v1",
)
result = RolloutResult.model_validate_json(_extract_text(raw))

print("reward:", result.reward)
print("turns:", len(result.proxy_turns))
print("files:", list(result.files.keys()))
print("wall:", result.wall_s, "s")

Expand All @@ -93,7 +94,6 @@ Expected output (~20s with the prebaked template):

```
reward: 1.0
turns: 3
files: ['/home/user/workdir/binary_search.py', ...]
wall: 19.8 s
```
Expand All @@ -102,10 +102,10 @@ wall: 19.8 s

```python
import os
from opencode_env import OpenCodeEnv
from coding_agent_env import CodingAgentEnv

# .sync() returns a synchronous wrapper around the async client.
with OpenCodeEnv(base_url="https://adithyask-opencode-env.hf.space").sync() as env:
with CodingAgentEnv(base_url="https://adithyask-coding-agent-env.hf.space").sync() as env:
env.reset()
# MCP tools are reachable via env.call_tool(...) / env.step(...) sync-wrapped.
# See the async example above for the full run_rollout signature.
Expand All @@ -120,23 +120,22 @@ For trainers that want to drive a sandbox directly without an HTTP boundary:

```python
import os
from opencode_env import (
OpenCodeConfig, OpenCodeSessionFactory, OpenCodeTask, E2BSandboxBackend,
from coding_agent_env import (
CodingAgentConfig, CodingAgentSessionFactory, CodingAgentTask, E2BSandboxBackend,
)

factory = OpenCodeSessionFactory(
config=OpenCodeConfig(
factory = CodingAgentSessionFactory(
config=CodingAgentConfig(
provider="openai_compatible",
base_url="https://api.openai.com/v1",
api_key=os.environ["OPENAI_API_KEY"],
model="gpt-4o-mini",
),
sandbox_backend=E2BSandboxBackend(),
mode="transparent_proxy", # captures per-token logprobs
mode="interception_gate", # trainer-owned interception mode
)
session = factory.create(task=OpenCodeTask(instruction="..."))
session = factory.create(task=CodingAgentTask(instruction="..."))
session.wait_for_completion()
turns = session.fetch_proxy_trace() # per-turn (tokens, logprobs)
session.close()
```

Expand All @@ -146,22 +145,22 @@ The Dockerfile lives at `server/Dockerfile`. Use the `openenv` CLI from
the env root:

```bash
cd envs/opencode_env
cd envs/coding_agent_env

openenv validate # check pyproject.toml + openenv.yaml + server/app.py + uv.lock
openenv build -t opencode-env # builds the image (uses server/Dockerfile)
openenv build -t coding-agent-env # builds the image (uses server/Dockerfile)

# run locally with E2B credentials
docker run -p 8000:8000 -e E2B_API_KEY=e2b_... opencode-env
docker run -p 8000:8000 -e E2B_API_KEY=e2b_... coding-agent-env

# push to HF Spaces (Docker variant)
openenv push --repo-id <user>/opencode-env
openenv push --repo-id <user>/coding-agent-env
```

Or build directly without the CLI:

```bash
docker build -t opencode-env -f envs/opencode_env/server/Dockerfile envs/opencode_env
docker build -t coding-agent-env -f envs/coding_agent_env/server/Dockerfile envs/coding_agent_env
```

The image:
Expand All @@ -174,7 +173,7 @@ The image:

## The MCP Tool: `run_rollout`

Single tool, two ways to specify the LLM endpoint:
Single tool, with an ``agent`` selector plus two ways to specify the LLM endpoint:

**Option A — endpoint shorthand (recommended)**: pass
`endpoint="vllm"` (or `"openai"` / `"hf_router"`). The server resolves
Expand All @@ -186,29 +185,30 @@ directly.

| Arg | Type | Default | Notes |
|---|---|---|---|
| `agent` | `str` | `"opencode"` | Harness to run: `"opencode"` or `"pi"`. |
| `endpoint` | `str` | `""` | One of `"vllm"` / `"openai"` / `"hf_router"`. |
| `base_url` / `api_key` / `model` | `str` | `""` | Override / supply explicitly. |
| `instruction` | `str` | required | Prompt passed to `opencode run`. |
| `instruction` | `str` | required | Prompt passed to the selected harness CLI. |
| `setup` | `list[str]` | `[]` | Bash commands run **before** the agent. |
| `verify` | `list[str]` | `[]` | Bash commands run **after** the agent. |
| `task_id` | `str` | `""` | Echoed back in result. |
| `mode` | `str` | `"transparent_proxy"` | Or `"black_box"` (no logprobs). |
| `mode` | `str` | `"black_box"` | Or `"interception_gate"` for trainer-owned generation. |
| `disable_thinking` | `bool \| None` | `None` (catalog default) | Inject `chat_template_kwargs.enable_thinking=false`. |
| `max_tokens_cap` | `int` | `4096` | Per-turn `max_tokens` clamp. |
| `top_logprobs` | `int` | `5` | HF Router cap is 5; OpenAI 0–20; vLLM unbounded. |
| `agent_timeout_s` | `float` | `600.0` | Hard wall budget for opencode. |
| `template` | `str` | `""` | E2B template name; `"opencode-rl"` skips ~2 min of install per rollout. |
| `top_logprobs` | `int` | `5` | Reserved for trainer-owned interception workflows. |
| `agent_timeout_s` | `float` | `600.0` | Hard wall budget for the selected harness. |
| `template` | `str` | `""` | E2B template name; `"coding-agent-rl"` skips ~2 min of install per rollout. |

Returns `RolloutResult` JSON with: `reward`, `setup_results[]`,
`verify_results[]`, `proxy_turns[]`, `files{}`, `agent_log_tail`,
`proxy_log_tail`, `wall_s`, `agent_exit_code`, `sandbox_id`, `error`.
`verify_results[]`, `files{}`, `agent_log_tail`, `wall_s`,
`agent_exit_code`, `sandbox_id`, `error`.

## Two Operating Modes

| Mode | What it does | Best for |
|---|---|---|
| **`transparent_proxy`** (default) | In-sandbox proxy at `localhost:7000` forwards opencode's LLM calls to `base_url`, injects `logprobs=true`, captures per-turn `(messages, completion_tokens, logprobs)` to `proxy_trace.jsonl`. | GRPO / RL training, observability, top-k distillation. |
| **`black_box`** | No proxy. opencode talks straight to `base_url`. | Smoke tests, eval, SFT data collection. |
| **`black_box`** (default) | The selected harness talks directly to `base_url`. | Smoke tests, eval, SFT data collection. |
| **`interception_gate`** | Agent calls are routed through trainer-host interception endpoints. Trainer owns forward pass + trajectory capture. | RL training with trainer-owned generation. |

## Environment Variables

Expand All @@ -227,68 +227,70 @@ sibling `.env` file; on HF Spaces, set them as **Space secrets**.
| **OpenAI endpoint** | | |
| `OPENAI_API_KEY` | required for `endpoint="openai"` | Standard OpenAI key. |
| `OPENAI_BASE_URL` | no | Defaults to `https://api.openai.com/v1`. |
| `OPENAI_MODEL` | no | Defaults to `gpt-4o-mini` (gpt-5.x and o-series refuse logprobs). |
| `OPENAI_MODEL` | no | Defaults to `gpt-4o-mini`. |
| **HF Router endpoint** | | |
| `HF_ROUTER_API_KEY` | required for `endpoint="hf_router"` | HF user token. |
| `HF_ROUTER_BASE_URL` | no | Defaults to `https://router.huggingface.co/v1`. |
| `HF_ROUTER_MODEL` | no | Defaults to `Qwen/Qwen3-4B-Instruct-2507:nscale`. |

Pick `provider:` suffixes that actually return logprobs:
**Together / Nscale / Scaleway / SambaNova / Cerebras**. Avoid Novita /
Hyperbolic / Featherless (silent drop) and Groq (HTTP 400).

## Pre-baked E2B Template

The first rollout in a fresh E2B sandbox spends ~2 min installing
opencode and the proxy's Python deps. Build a one-time template that
ships those pre-installed:
harness tooling. Build a one-time template that ships those pre-installed:

```bash
.venv/bin/python envs/opencode_env/sandbox/build_template.py
# → builds `opencode-rl` template in your E2B account (~1m20s, one-time)
.venv/bin/python envs/coding_agent_env/sandbox/build_template.py
# → builds `coding-agent-rl` template in your E2B account (~1m20s, one-time)
```

After this, pass `template="opencode-rl"` on every `run_rollout` call —
After this, pass `template="coding-agent-rl"` on every `run_rollout` call —
each rollout drops to ~20–30s end-to-end.

## Project Structure

```
opencode_env/
coding_agent_env/
├── README.md # this file
├── openenv.yaml # OpenEnv space spec
├── pyproject.toml # deps + ``server`` entrypoint
├── uv.lock # frozen deps (required by ``openenv validate``)
├── .gitignore / .dockerignore # excludes .env / __pycache__
├── __init__.py # re-exports primitive + client + models
├── client.py # OpenCodeEnv(MCPToolClient)
├── models.py # RolloutResult / RolloutTurn / OpenCodeState
├── client.py # CodingAgentEnv(MCPToolClient)
├── models.py # RolloutResult / CodingAgentState
├── config.py # OpenCodeConfig (primitive)
├── harness.py # OpenCodeSession / OpenCodeSessionFactory (CLI-only)
├── config.py # CodingAgentConfig (primitive)
├── harness.py # CodingAgentSession / CodingAgentSessionFactory (CLI-only)
├── opencode_runtime.py # opencode.json builder + cmds
├── task.py # OpenCodeTask
├── task.py # CodingAgentTask
├── server/
│ ├── __init__.py
│ ├── app.py # FastAPI factory; mounts Gradio at /web
│ ├── opencode_environment.py # MCPEnvironment with single ``run_rollout`` tool
│ ├── coding_environment.py # MCPEnvironment with single ``run_rollout`` tool
│ ├── gradio_ui.py # the /web Gradio Blocks UI
│ ├── catalog.py # endpoint shorthand resolver
│ └── Dockerfile # multi-stage uv build (used by ``openenv build``)
└── sandbox/
├── __init__.py
├── base.py # SandboxBackend / SandboxHandle Protocols
├── e2b.py # E2B implementation
├── interception.py # in-sandbox FastAPI proxy (logprob capture)
└── build_template.py # one-time E2B template builder

# Shared sandbox runtime (moved to core):
src/openenv/core/harness/sandbox/
├── base.py # SandboxBackend / SandboxHandle protocols
├── e2b_backend.py # E2B implementation
├── docker_backend.py # local Docker backend
├── hf_backend.py # HF sandbox backend
└── _util.py # shared sandbox shell utilities
```

## References

- [OpenEnv docs](https://meta-pytorch.org/OpenEnv/)
- [OpenCode CLI](https://opencode.ai/docs/cli/)
- [Pi](https://github.com/badlogic/pi-mono)
- [E2B Python SDK](https://e2b.dev/docs)
- [HF Inference Providers logprob matrix](../../../DOCS/HF/hf_inference_providers_logprobs.md)

55 changes: 55 additions & 0 deletions envs/coding_agent_env/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

"""Coding-agent environment for OpenEnv.

Two layers in this package:

1. **Harness primitive** -- :class:`CodingAgentSessionFactory` /
:class:`CodingAgentSession` / :class:`CodingAgentConfig` /
:class:`E2BSandboxBackend`. Built on the generic
:class:`CLIAgentDriver` from ``openenv.core.harness.agents``.

2. **Deployable env** -- :class:`CodingAgentEnv` (MCP client) talks to the
FastAPI server at ``server/app.py`` over HTTP. Use this when the
sandbox + agent live behind an HTTP boundary (e.g. an HF Space).
See ``client.py`` and ``server/``.
"""

from openenv.core.env_server.mcp_types import CallToolAction, ListToolsAction
from openenv.core.harness.sandbox import SandboxBackend, SandboxHandle

from .client import CodingAgentEnv
from .config import CodingAgentConfig, Provider
from .harness import CodingAgentSession, CodingAgentSessionFactory
from .models import CommandResult, CodingAgentState, RolloutResult
from .task import CodingAgentTask

try:
from openenv.core.harness.sandbox import E2BSandboxBackend
except ImportError: # e2b not installed
E2BSandboxBackend = None # type: ignore[assignment,misc]

__all__ = [
# Deployed-env client
"CodingAgentEnv",
"CallToolAction",
"ListToolsAction",
# HTTP API models
"CommandResult",
"CodingAgentState",
"RolloutResult",
# Harness primitive
"CodingAgentConfig",
"CodingAgentSession",
"CodingAgentSessionFactory",
"CodingAgentTask",
"Provider",
# Sandbox backend
"E2BSandboxBackend",
"SandboxBackend",
"SandboxHandle",
]
Loading