Skip to content

Instantly share code, notes, and snippets.

View burtenshaw's full-sized avatar

burtenshaw

View GitHub Profile
@burtenshaw
burtenshaw / nano_harness.py
Created February 20, 2026 14:36
Nano Harness: Agent Harness in 223 lines
import json
import os
import re
import shlex
import subprocess
import sys
import time
import traceback
import urllib.error
import urllib.request
@burtenshaw
burtenshaw / test_concurrency.py
Created December 8, 2025 10:09
test concurrency on openenv
#!/usr/bin/env python3
"""
Test script for benchmark environment concurrency.
Run the server first:
cd benchmark && uvicorn server.app:app --reload --port 8000
Then run this script:
python test_concurrency.py --requests 10 --wait 1.0
"""
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "huggingface-hub>=1.1.4",
# "python-dotenv>=1.2.1",
# "pyyaml>=6.0.3",
# "requests>=2.32.5",
# ]
# ///
@burtenshaw
burtenshaw / openenv_browsergym_grpo.py
Last active November 13, 2025 20:49
OpenEnv + TRL on BrowserGym
#!/usr/bin/env python3
"""
GRPO training for BrowserGym tasks using TRL's `GRPOTrainer` and the OpenEnv HTTP
environment interface.
"""
from __future__ import annotations
from datetime import datetime
import sys
#!/usr/bin/env python3
#
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "git+https://github.com/huggingface/trl.git#egg=trl[vllm]",
# "trackio==0.8.1",
# ///
"""
#!/usr/bin/env python3
#
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "git+https://github.com/huggingface/trl.git#egg=trl[vllm]",
# "trackio==0.8.1",
# ///
"""
#!/usr/bin/env python3
"""
GRPO training for BrowserGym tasks using TRL's `GRPOTrainer` and the OpenEnv HTTP
environment interface.
Usage:
# First, start a BrowserGym server (Docker or local) and note its base URL.
# For MiniWoB++ you can use the official BrowserGym container.
# Then run this training script (customise env vars as needed):
#!/usr/bin/env python3
"""
GRPO training for Wordle using TRL's `GRPOTrainer` and the TextArena OpenEnv environment.
Usage:
# First, start the TextArena Wordle server (Docker or local):
TEXTARENA_ENV_ID=Wordle-v0 TEXTARENA_NUM_PLAYERS=1 \
python -m src.envs.textarena_env.server.app
# Then run this training script:
# Copyright 2020-2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# Copyright 2020-2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,