Buckets:

download
raw
46.1 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;TB2 Environment (Terminal-Bench 2)&quot;,&quot;local&quot;:&quot;tb2-environment-terminal-bench-2&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Quick Start&quot;,&quot;local&quot;:&quot;quick-start&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Building the Docker Image&quot;,&quot;local&quot;:&quot;building-the-docker-image&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Environment Details&quot;,&quot;local&quot;:&quot;environment-details&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Action&quot;,&quot;local&quot;:&quot;action&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Observation&quot;,&quot;local&quot;:&quot;observation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;State&quot;,&quot;local&quot;:&quot;state&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Execution Modes&quot;,&quot;local&quot;:&quot;execution-modes&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Local Mode (Default)&quot;,&quot;local&quot;:&quot;local-mode-default&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Docker Mode&quot;,&quot;local&quot;:&quot;docker-mode&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Action Types&quot;,&quot;local&quot;:&quot;action-types&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Session IDs (Streaming Processes)&quot;,&quot;local&quot;:&quot;session-ids-streaming-processes&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Environment Variables&quot;,&quot;local&quot;:&quot;environment-variables&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reward&quot;,&quot;local&quot;:&quot;reward&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Running the Server&quot;,&quot;local&quot;:&quot;running-the-server&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Project Structure&quot;,&quot;local&quot;:&quot;project-structure&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}">
<link href="/docs/openenv/pr_751/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/entry/start.9f055248.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/scheduler.2b22cead.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/singletons.2367fb48.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/paths.73efe477.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/entry/app.52235c9f.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/preload-helper.405ae71f.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/index.1a0e8013.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/nodes/0.6e4dd9a0.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/each.e59479a4.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/nodes/32.f85a63b6.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.a01de1eb.js">
<link rel="modulepreload" href="/docs/openenv/pr_751/en/_app/immutable/chunks/CodeBlock.81c04d9c.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;TB2 Environment (Terminal-Bench 2)&quot;,&quot;local&quot;:&quot;tb2-environment-terminal-bench-2&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Quick Start&quot;,&quot;local&quot;:&quot;quick-start&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Building the Docker Image&quot;,&quot;local&quot;:&quot;building-the-docker-image&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Environment Details&quot;,&quot;local&quot;:&quot;environment-details&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Action&quot;,&quot;local&quot;:&quot;action&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Observation&quot;,&quot;local&quot;:&quot;observation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;State&quot;,&quot;local&quot;:&quot;state&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Execution Modes&quot;,&quot;local&quot;:&quot;execution-modes&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Local Mode (Default)&quot;,&quot;local&quot;:&quot;local-mode-default&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Docker Mode&quot;,&quot;local&quot;:&quot;docker-mode&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Action Types&quot;,&quot;local&quot;:&quot;action-types&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Session IDs (Streaming Processes)&quot;,&quot;local&quot;:&quot;session-ids-streaming-processes&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Environment Variables&quot;,&quot;local&quot;:&quot;environment-variables&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reward&quot;,&quot;local&quot;:&quot;reward&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Running the Server&quot;,&quot;local&quot;:&quot;running-the-server&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Project Structure&quot;,&quot;local&quot;:&quot;project-structure&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <h1 class="relative group"><a id="tb2-environment-terminal-bench-2" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#tb2-environment-terminal-bench-2"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>TB2 Environment (Terminal-Bench 2)</span></h1> <p data-svelte-h="svelte-15c58j5">OpenEnv wrapper for <a href="https://github.com/laude-institute/terminal-bench-2" rel="nofollow">Terminal-Bench 2</a> tasks. Supports two execution modes:</p> <table data-svelte-h="svelte-y5xidd"><thead><tr><th>Mode</th> <th>Description</th> <th>Use Case</th></tr></thead> <tbody><tr><td><strong>Local</strong></td> <td>Runs commands in the server process (no Docker)</td> <td>Hugging Face Spaces, environments without Docker access</td></tr> <tr><td><strong>Docker</strong></td> <td>Runs each task in its own container</td> <td>Full TB2.0 fidelity with custom task images</td></tr></tbody></table> <h2 class="relative group"><a id="quick-start" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#quick-start"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Quick Start</span></h2> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-python "><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> tbench2_env <span class="hljs-keyword">import</span> Tbench2Env, Tbench2Action
env = Tbench2Env(base_url=<span class="hljs-string">&quot;http://localhost:8000&quot;</span>)
result = env.reset(task_id=<span class="hljs-string">&quot;headless-terminal&quot;</span>)
<span class="hljs-built_in">print</span>(result.observation.instruction)
result = env.step(Tbench2Action(action_type=<span class="hljs-string">&quot;exec&quot;</span>, command=<span class="hljs-string">&quot;ls -la&quot;</span>))
<span class="hljs-built_in">print</span>(result.observation.output)
result = env.step(Tbench2Action(action_type=<span class="hljs-string">&quot;evaluate&quot;</span>))
<span class="hljs-built_in">print</span>(result.reward, result.done)
env.close()<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="building-the-docker-image" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#building-the-docker-image"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Building the Docker Image</span></h2> <p data-svelte-h="svelte-ibz1up">Before using the environment, build the Docker image:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-bash "><!-- HTML_TAG_START --><span class="hljs-comment"># From project root</span>
docker build -t tbench2-env:latest -f envs/tbench2_env/server/Dockerfile .<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="environment-details" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#environment-details"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Environment Details</span></h2> <h3 class="relative group"><a id="action" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#action"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Action</span></h3> <p data-svelte-h="svelte-1qnlmmv"><strong>Tbench2Action</strong>: Controls interaction with the TB2 task session</p> <table data-svelte-h="svelte-3t3a65"><thead><tr><th>Field</th> <th>Type</th> <th>Default</th> <th>Description</th></tr></thead> <tbody><tr><td><code>action_type</code></td> <td>str</td> <td><code>&quot;exec&quot;</code></td> <td>Action to perform (<code>exec</code>, <code>write</code>, <code>view</code>, <code>wait</code>, <code>kill</code>, <code>write_file</code>, <code>evaluate</code>, <code>close</code>)</td></tr> <tr><td><code>command</code></td> <td>str</td> <td><code>&quot;&quot;</code></td> <td>Shell command or input to send</td></tr> <tr><td><code>session_id</code></td> <td>str | None</td> <td><code>None</code></td> <td>Session ID for streaming processes</td></tr> <tr><td><code>block</code></td> <td>bool</td> <td><code>True</code></td> <td>Whether to block until command completes</td></tr> <tr><td><code>wait_seconds</code></td> <td>float | None</td> <td><code>None</code></td> <td>Time to wait (for <code>wait</code> action)</td></tr> <tr><td><code>file_path</code></td> <td>str</td> <td><code>&quot;&quot;</code></td> <td>File path (for <code>write_file</code> action)</td></tr> <tr><td><code>content</code></td> <td>str</td> <td><code>&quot;&quot;</code></td> <td>Content to write (for <code>write_file</code> action)</td></tr></tbody></table> <h3 class="relative group"><a id="observation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#observation"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Observation</span></h3> <p data-svelte-h="svelte-1chsir"><strong>Tbench2Observation</strong>: Contains the environment response</p> <table data-svelte-h="svelte-1e09tcv"><thead><tr><th>Field</th> <th>Type</th> <th>Description</th></tr></thead> <tbody><tr><td><code>instruction</code></td> <td>str</td> <td>Task instruction/prompt from the TB2 task</td></tr> <tr><td><code>output</code></td> <td>str</td> <td>Command output (stdout/stderr)</td></tr> <tr><td><code>success</code></td> <td>bool</td> <td>Whether the action succeeded</td></tr> <tr><td><code>error</code></td> <td>str</td> <td>Error message if action failed</td></tr> <tr><td><code>task_id</code></td> <td>str</td> <td>Current task identifier</td></tr> <tr><td><code>task_path</code></td> <td>str</td> <td>Path to the task directory</td></tr> <tr><td><code>session_id</code></td> <td>str | None</td> <td>Session ID for streaming processes</td></tr> <tr><td><code>action_type</code></td> <td>str</td> <td>The action type that produced this observation</td></tr> <tr><td><code>info</code></td> <td>dict</td> <td>Additional metadata</td></tr></tbody></table> <h3 class="relative group"><a id="state" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#state"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>State</span></h3> <p data-svelte-h="svelte-58sd95"><strong>Tbench2State</strong>: Server-side state for the task session</p> <table data-svelte-h="svelte-liddk3"><thead><tr><th>Field</th> <th>Type</th> <th>Description</th></tr></thead> <tbody><tr><td><code>task_id</code></td> <td>str</td> <td>Current task identifier</td></tr> <tr><td><code>task_path</code></td> <td>str</td> <td>Path to the task directory</td></tr> <tr><td><code>session_id</code></td> <td>str</td> <td>Active session ID</td></tr> <tr><td><code>terminal_ready</code></td> <td>bool</td> <td>Whether the terminal is ready for commands</td></tr> <tr><td><code>last_action_type</code></td> <td>str</td> <td>Last action type executed</td></tr> <tr><td><code>last_command</code></td> <td>str</td> <td>Last command executed</td></tr> <tr><td><code>last_output</code></td> <td>str</td> <td>Output from last command</td></tr></tbody></table> <h2 class="relative group"><a id="execution-modes" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#execution-modes"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Execution Modes</span></h2> <h3 class="relative group"><a id="local-mode-default" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#local-mode-default"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Local Mode (Default)</span></h3> <p data-svelte-h="svelte-t97tx2">Commands execute directly in the server process. Ideal for HF Spaces where Docker-in-Docker is unavailable.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-bash "><!-- HTML_TAG_START --><span class="hljs-comment"># Default - local mode</span>
python -m tbench2_env.server.app
<span class="hljs-comment"># Or explicitly set mode</span>
TB2_MODE=<span class="hljs-built_in">local</span> python -m tbench2_env.server.app<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-8v0f89"><strong>Note:</strong> Local mode ignores Docker images specified in task.toml. Tasks requiring specific runtime environments may fail.</p> <h3 class="relative group"><a id="docker-mode" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#docker-mode"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Docker Mode</span></h3> <p data-svelte-h="svelte-atpxk3">Each task runs in its own Docker container, using the image specified in the task’s <code>task.toml</code>:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-bash "><!-- HTML_TAG_START --><span class="hljs-comment"># Enable Docker mode</span>
TB2_MODE=docker python -m tbench2_env.server.app<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-11lzvnb"><strong>Requirements:</strong></p> <ul data-svelte-h="svelte-11cwpvy"><li>Docker socket mounted at <code>/var/run/docker.sock</code></li> <li>Sufficient disk space for container images</li> <li>Network access to pull images if not cached</li></ul> <p data-svelte-h="svelte-36jjf7"><strong>Environment Variables for Docker Mode:</strong></p> <ul data-svelte-h="svelte-ygg8pv"><li><code>TB2_MODE=docker</code> - Enable Docker-backed execution</li> <li>Docker socket must be accessible (mounted volume)</li></ul> <h2 class="relative group"><a id="action-types" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#action-types"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Action Types</span></h2> <table data-svelte-h="svelte-1pcvvqm"><thead><tr><th>Action</th> <th>Description</th> <th>Required Fields</th></tr></thead> <tbody><tr><td><code>exec</code></td> <td>Run a shell command</td> <td><code>command</code>, optionally <code>block</code>, <code>session_id</code></td></tr> <tr><td><code>write</code></td> <td>Send input to a running session</td> <td><code>session_id</code>, <code>command</code></td></tr> <tr><td><code>view</code></td> <td>Read pending output</td> <td><code>session_id</code></td></tr> <tr><td><code>wait</code></td> <td>Wait for output</td> <td><code>session_id</code>, optionally <code>wait_seconds</code></td></tr> <tr><td><code>kill</code></td> <td>Terminate a running session</td> <td><code>session_id</code></td></tr> <tr><td><code>write_file</code></td> <td>Write content to a file</td> <td><code>file_path</code>, <code>content</code></td></tr> <tr><td><code>evaluate</code></td> <td>Run pytest tests, return reward</td> <td>(none)</td></tr> <tr><td><code>close</code></td> <td>Stop and cleanup</td> <td>(none)</td></tr></tbody></table> <h2 class="relative group"><a id="session-ids-streaming-processes" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#session-ids-streaming-processes"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Session IDs (Streaming Processes)</span></h2> <p data-svelte-h="svelte-1gk4hw0"><code>session_id</code> is <strong>only</strong> required when you start a non-blocking process and want to interact with it (<code>write</code>, <code>view</code>, <code>wait</code>, <code>kill</code>). For plain <code>exec</code> commands, you can omit it.</p> <p data-svelte-h="svelte-1nc19n7">Example (Python):</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-python "><!-- HTML_TAG_START --><span class="hljs-comment"># Start a long-running process</span>
env.step(Tbench2Action(action_type=<span class="hljs-string">&quot;exec&quot;</span>, command=<span class="hljs-string">&quot;python -i&quot;</span>, block=<span class="hljs-literal">False</span>, session_id=<span class="hljs-string">&quot;sess1&quot;</span>))
<span class="hljs-comment"># Send input to it</span>
env.step(Tbench2Action(action_type=<span class="hljs-string">&quot;write&quot;</span>, session_id=<span class="hljs-string">&quot;sess1&quot;</span>, command=<span class="hljs-string">&quot;print(2+2)\n&quot;</span>))
<span class="hljs-comment"># Read its output</span>
env.step(Tbench2Action(action_type=<span class="hljs-string">&quot;view&quot;</span>, session_id=<span class="hljs-string">&quot;sess1&quot;</span>))<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="environment-variables" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#environment-variables"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Environment Variables</span></h2> <table data-svelte-h="svelte-t5pwyi"><thead><tr><th>Variable</th> <th>Default</th> <th>Description</th></tr></thead> <tbody><tr><td><code>TB2_MODE</code></td> <td><code>local</code></td> <td>Execution mode: <code>local</code> or <code>docker</code></td></tr> <tr><td><code>TB2_TASKS_DIR</code></td> <td>(auto-download)</td> <td>Path to local Terminal-Bench-2 repo checkout</td></tr> <tr><td><code>TB2_OUTPUT_DIR</code></td> <td><code>/tmp/tbench2_env_runs</code></td> <td>Directory for session logs and cache</td></tr> <tr><td><code>TB2_CACHE_DIR</code></td> <td><code>$TB2_OUTPUT_DIR/repo_cache</code></td> <td>Where to extract TB2 repo</td></tr> <tr><td><code>TB2_REPO_URL</code></td> <td>(GitHub main.zip)</td> <td>Repo zip URL for auto-download</td></tr></tbody></table> <h2 class="relative group"><a id="reward" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#reward"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Reward</span></h2> <p data-svelte-h="svelte-dg496f">Binary reward on <code>evaluate</code> action:</p> <ul data-svelte-h="svelte-1qhtkbg"><li><code>1.0</code> - All pytest tests pass (exit code 0)</li> <li><code>0.0</code> - Tests fail (non-zero exit code)</li></ul> <p data-svelte-h="svelte-caxb63">Intermediate steps return <code>reward=None</code>.</p> <h2 class="relative group"><a id="running-the-server" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#running-the-server"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Running the Server</span></h2> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-bash "><!-- HTML_TAG_START --><span class="hljs-comment"># Install dependencies</span>
uv <span class="hljs-built_in">sync</span> --all-extras
<span class="hljs-comment"># Local mode (default, for Spaces)</span>
python -m tbench2_env.server.app --port 8000
<span class="hljs-comment"># Docker mode (full TB2.0 compatibility)</span>
TB2_MODE=docker python -m tbench2_env.server.app --port 8000
<span class="hljs-comment"># With local TB2 repo</span>
TB2_TASKS_DIR=/path/to/terminal-bench-2 python -m tbench2_env.server.app<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="project-structure" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#project-structure"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Project Structure</span></h2> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=" "><!-- HTML_TAG_START -->tbench2_env/
├── __init__.py <span class="hljs-meta"># Module exports (Tbench2Env, Tbench2Action, etc.)</span>
├── README.md <span class="hljs-meta"># This file</span>
├── <span class="hljs-keyword">client</span>.py <span class="hljs-meta"># Tbench2Env client implementation</span>
├── models.py <span class="hljs-meta"># Tbench2Action, Tbench2Observation, Tbench2State</span>
├── openenv.yaml <span class="hljs-meta"># OpenEnv configuration</span>
├── pyproject.toml <span class="hljs-meta"># Package dependencies</span>
└── <span class="hljs-keyword">server</span>/
├── __init__.py <span class="hljs-meta"># Server exports</span>
├── app.py <span class="hljs-meta"># FastAPI application</span>
├── tbench2_env_environment.py <span class="hljs-meta"># Core environment logic</span>
└── Dockerfile <span class="hljs-meta"># Container image definition</span><!-- HTML_TAG_END --></pre></div> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/openenv/blob/main/docs/source/environments/tbench2.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p>
<script>
{
__sveltekit_1wxcoil = {
assets: "/docs/openenv/pr_751/en",
base: "/docs/openenv/pr_751/en",
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null];
Promise.all([
import("/docs/openenv/pr_751/en/_app/immutable/entry/start.9f055248.js"),
import("/docs/openenv/pr_751/en/_app/immutable/entry/app.52235c9f.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 32],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
46.1 kB
·
Xet hash:
1620171d0758b8ee0294716ce6663864b3e1605136732d72e321ddf6031f4b12

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.