{"name":"EnvHarness: Dynamically Adapting Environments for Agent Learning","description":"EnvHarness empowers large language models (LLMs) acting as autonomous agents to learn more effectively from interactive environments. It achieves this by wrapping static environments with plug-in components, making them dynamically controllable without altering their internal code. This innovative approach allows environments to target specific agent weaknesses and continuously teach as agents improve, leading to more effective and efficient learning outcomes.","github":"https://github.com/google-research/envharness","url":"https://osrepos.com/repo/google-research-envharness","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/google-research-envharness","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/google-research-envharness.md","json":"https://osrepos.com/repo/google-research-envharness.json","topics":["Python","AI","LLM","Reinforcement Learning","Agent Learning","Environment Simulation","Machine Learning","Google Research"],"keywords":["Python","AI","LLM","Reinforcement Learning","Agent Learning","Environment Simulation","Machine Learning","Google Research"],"stars":null,"summary":"EnvHarness empowers large language models (LLMs) acting as autonomous agents to learn more effectively from interactive environments. It achieves this by wrapping static environments with plug-in components, making them dynamically controllable without altering their internal code. This innovative approach allows environments to target specific agent weaknesses and continuously teach as agents improve, leading to more effective and efficient learning outcomes.","content":"## Introduction\n\nAs large language models (LLMs) evolve into autonomous agents, their learning increasingly shifts from curated text to interactive environments. However, these environments are often expensive to build and remain static, failing to adapt to an agent's progress or specific weaknesses. EnvHarness addresses this challenge by applying the \"agent harness\" concept to environments themselves. It wraps a **frozen environment** with its own plug-in components, making it dynamically controllable without requiring any changes to the environment's internal code.\n\nThis dynamic layer is built from three core plug-in components:\n*   **Setup**: Reshapes the initial state of the environment.\n*   **Rule**: Modifies the interaction, including allowed actions, their effects, and agent observations.\n*   **Link**: Composes tasks from another environment into the current one.\n\nThese components operate strictly at the standard `reset` and `step` interface, ensuring that the original benchmark's trusted, human-built verifiers remain untouched. This benchmark-agnostic system works across various domains, enabling a designer agent to diagnose agent weaknesses, write components to target them, and iteratively improve the environment to teach what the agent lacks.\n\n## Why Use EnvHarness and Key Benefits\n\nEnvHarness offers significant advantages for developing and training LLM agents:\n\n### Enhanced Agent Learning\nSkills learned in EnvHarness-adapted environments consistently outperform both no-skill baselines and skills learned in original, static environments. Agents demonstrate increased effectiveness (up to +9 points on held-out tasks) and improved efficiency (~9.8% fewer interaction steps). The system also produces stronger policies under reinforcement learning, with gains compounding through repeated designer loops.\n\n### Key Features\n*   **Frozen Environments, No Internal Edits**: The benchmark's task set, dynamics, and grading remain exactly as published. Only the layer through which the agent interacts changes.\n*   **Code as the EnvHarness**: The designer agent generates real Python code, specifically a `_Rules(Rules)` subclass, rather than selecting from a fixed menu. This code is compiled and executed in an isolated subprocess, ensuring robustness.\n*   **Composable by Construction**: An `EnvHarness` itself acts as an `ActionableEnv` that wraps another, allowing layers to stack arbitrarily. This ensures a single, consistent interface for any benchmark.\n*   **Benchmark-Agnostic**: Integrating a new environment simply requires implementing one interface (`ActionableEnv`). The designer, components, learning loop, and evaluation stages require no further modifications.\n\n## Quickstart Guide\n\nTo get started with EnvHarness, you'll typically configure your LLM provider and then run one of the provided benchmarks.\n\n### LLM Configuration\nEnvHarness supports various LLM providers. You'll need to set up your API keys or credentials:\n\n*   **GPT (OpenAI)**:\n    bash\n    export OPENAI_API_KEY=\"your-openai-api-key\"\n    \n*   **Claude (Vertex AI)**:\n    bash\n    gcloud auth application-default login\n    export GOOGLE_CLOUD_PROJECT=\"your-project-id\"\n    pip install \"google-cloud-aiplatform>=1.38\"\n    \n*   **Gemini**:\n    bash\n    export GEMINI_API_KEY=\"your-gemini-api-key\"\n    \n\nYou can specify the model in your configuration YAML or via an environment variable:\nyaml\npolicy:\n  model: openai/gpt-4.1-mini\nmutator:\n  type: llm\n  model: vertex_ai/claude-sonnet-4-6\n\nOr, to override for a full run:\nbash\nMODEL=openai/gpt-4.1 python experiments/swebench/reproduce.py\n\n\n### Run a Benchmark\nEach benchmark has its own environment and a dedicated driver. For detailed setup and commands, refer to the `README.md` file within the specific experiment folder you wish to run.\n\nCommon commands include:\n*   Preflight check:\n    bash\n    python scripts/check_env.py <benchmark>\n    \n*   Smoke test (fewer tasks):\n    bash\n    bash experiments/<benchmark>/reproduce_smoke.sh\n    \n*   Full protocol:\n    bash\n    python experiments/<benchmark>/reproduce.py\n    \n\n## Benchmarks and Examples\n\nEnvHarness has been tested across a range of benchmarks. You can find examples and reproduction scripts in the `experiments/` directory:\n\n*   [`experiments/toy24`](https://github.com/google-research/envharness/tree/main/experiments/toy24)\n*   [`experiments/alfworld`](https://github.com/google-research/envharness/tree/main/experiments/alfworld)\n*   [`experiments/swebench`](https://github.com/google-research/envharness/tree/main/experiments/swebench)\n*   [`experiments/webarena`](https://github.com/google-research/envharness/tree/main/experiments/webarena)\n*   [`experiments/officeqa`](https://github.com/google-research/envharness/tree/main/experiments/officeqa)\n*   [`experiments/spreadsheetbench`](https://github.com/google-research/envharness/tree/main/experiments/spreadsheetbench)\n\nFor reinforcement learning training with policies directly inside EnvHarness environments, explore the [`rl/`](https://github.com/google-research/envharness/tree/main/rl) directory.\n\n## Links\n\n*   **GitHub Repository**: <a href=\"https://github.com/google-research/envharness\" target=\"_blank\" rel=\"noopener noreferrer\">google-research/envharness</a>\n*   **Paper**: <a href=\"https://arxiv.org/abs/2608.19880\" target=\"_blank\" rel=\"noopener noreferrer\">EnvHarness: Awakening Static Worlds for Agent Learning</a>\n*   **Project Webpage**: <a href=\"https://envharness.com/\" target=\"_blank\" rel=\"noopener noreferrer\">envharness.com</a>","metrics":{"detailViews":3,"githubClicks":6},"dates":{"published":null,"modified":"2026-09-03T08:54:34.000Z"}}