Deploy standalone SmolDataEnv Native OpenCode
Browse files- smoldataenv_opencode/server.py +3 -0
- smoldataenv_opencode/ui.py +34 -0
smoldataenv_opencode/server.py
CHANGED
|
@@ -11,6 +11,7 @@ from openenv.core.env_server.types import Observation, State
|
|
| 11 |
|
| 12 |
from .catalog import TaskCatalog, task_by_name
|
| 13 |
from .environment import TaskFactory
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
class OpenCodeEnvironment(TaskCatalog, MCPEnvironment):
|
|
@@ -67,6 +68,8 @@ app = create_app(
|
|
| 67 |
OpenCodeEnvironment,
|
| 68 |
CallToolAction,
|
| 69 |
CallToolObservation,
|
|
|
|
|
|
|
| 70 |
env_name="smoldataenv_opencode",
|
| 71 |
max_concurrent_envs=int(os.environ.get("MAX_CONCURRENT_ENVS", "40")),
|
| 72 |
)
|
|
|
|
| 11 |
|
| 12 |
from .catalog import TaskCatalog, task_by_name
|
| 13 |
from .environment import TaskFactory
|
| 14 |
+
from .ui import build_ui
|
| 15 |
|
| 16 |
|
| 17 |
class OpenCodeEnvironment(TaskCatalog, MCPEnvironment):
|
|
|
|
| 68 |
OpenCodeEnvironment,
|
| 69 |
CallToolAction,
|
| 70 |
CallToolObservation,
|
| 71 |
+
gradio_builder=build_ui,
|
| 72 |
+
show_default_tab=False,
|
| 73 |
env_name="smoldataenv_opencode",
|
| 74 |
max_concurrent_envs=int(os.environ.get("MAX_CONCURRENT_ENVS", "40")),
|
| 75 |
)
|
smoldataenv_opencode/ui.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Use OpenEnv's playground with connection examples for this environment."""
|
| 2 |
+
|
| 3 |
+
from openenv.core.env_server.gradio_ui import build_gradio_app
|
| 4 |
+
|
| 5 |
+
QUICK_START = """
|
| 6 |
+
This environment runs native OpenCode in Daytona and returns its grade and
|
| 7 |
+
training trace. Configure `SANDBOX_VLLM_URL` and `SANDBOX_VLLM_KEY` on the server
|
| 8 |
+
before a rollout. The endpoint must return token IDs and logprobs for training.
|
| 9 |
+
|
| 10 |
+
Click **Reset**, set Type to `call_tool`, and use Tool Name `run_rollout`.
|
| 11 |
+
Arguments require `split`, `task_name`, `model` and a `sampling` object.
|
| 12 |
+
Use the Task API at `/docs` to find a task name.
|
| 13 |
+
|
| 14 |
+
From Python:
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
import requests
|
| 18 |
+
from openenv.core.mcp_client import MCPToolClient
|
| 19 |
+
|
| 20 |
+
url = "https://fineenvs-data-agent-blackbox-opencode-env.hf.space"
|
| 21 |
+
task = requests.post(url + "/smoldataenv_opencode/task",
|
| 22 |
+
json={"split": "test", "index": 0}).json()["task"]
|
| 23 |
+
with MCPToolClient(url, message_timeout_s=1800).sync() as env:
|
| 24 |
+
env.reset()
|
| 25 |
+
result = env.call_tool("run_rollout", split="test", task_name=task["name"],
|
| 26 |
+
model="YOUR_SERVED_MODEL", sampling={"temperature": 0.8})
|
| 27 |
+
```
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def build_ui(manager, fields, metadata, is_chat, title, quick_start):
|
| 32 |
+
return build_gradio_app(
|
| 33 |
+
manager, fields, metadata, is_chat, title=title, quick_start_md=QUICK_START
|
| 34 |
+
)
|