Join the conversation

Join the community of Machine Learners and AI enthusiasts.

Sign Up
sergiopaniego 
posted an update 2 days ago
Post
78
you can now train your own coding agents with trl + openenv, starting with opencode

we just added end-to-end support for training agent harnesses:

> TRL: a loop-owning training path (AsyncGRPOTrainer + HarnessRolloutWorker) that launches the agent in an OpenEnv session, reads back its trace, reconstructs the training samples, and trains with AsyncGRPO
> OpenEnv: the OpenCode harness environment plus a transparent proxy that forwards the agent's model calls and records each turn's token ids and logprobs

you train the actual opencode agent as is, it runs its own loop and tools and the policy learns from the exact tokens it produced

we're shipping a self-contained example: local subprocess sandbox, DeepCoder problems, validated on Qwen3-8B.

> example: https://github.com/huggingface/trl/blob/main/examples/scripts/openenv/opencode.py
> docs: https://huggingface.co/docs/trl/main/openenv

and we're working actively on both sides so expect more 🤓

The part that matters is not the trainer, it's what it trains on.

Most agent-RL setups approximate the deployed harness in a rollout worker, so the policy gets good at the approximation. Here the proxy forwards the actual opencode loop and records the exact tokens it produced, so there's no re-implementation gap between what you train on and what ships.

Agentic degradation usually shows up exactly where the harness stumbles, not on the clean path. Does the recorded trace carry opencode's own failed tool calls and retries, or only the successful turns that made it into training?