openhands harness runs OpenHands against the repository workspace prepared by a benchmark. It is intended for repository-repair benchmarks such as SWE-bench Verified, SWE-bench Multilingual, SWE-bench Pro, and SWE-bench Pro Verified. It can also serve as a terminal-operation harness for benchmarks such as Terminal-Bench 2.
AgentCompass installs a pinned OpenHands SDK/tools runtime inside the selected environment, passes the issue prompt and model endpoint to OpenHands, forwards terminal actions to the prepared workspace, and converts the OpenHands event history into the standard RunResult trajectory. The model under test is configured by the CLI --model-* flags; both openai-chat and openai-responses are supported.
Set agent setup/run environment variables with --env-params '{"run_env_variables":{"MY_VARIABLE":"value"}}'. The former Harness env field is no longer accepted. These variables apply to installation, agent execution, and its tools; they are removed from subsequent artifact and verifier commands. See Task environment variables.
How it works
- Prepare an isolated runtime. By default, the harness creates
/opt/agentcompass/openhands/runtimethrough micromamba. Withsetup_capsule_tag, a predefined Python 3.12 Capsule installs packages under/tmp/agentcompass-capsule-setups/<bundle-sha256>instead. Both paths installopenhands-sdk/openhands-toolsatopenhands_version, probe the imports, and upload the AgentCompass entrypoint. - Build the OpenHands conversation. The benchmark-provided prompt and workspace are passed to an OpenHands
Conversation.tool_presetselects the terminal/editor tool set, and an optional condenser summarizes older events.max_iterationslimits iteration count;conversation_timeoutcontrols one LLM request,command_timeoutcontrols one terminal command,terminal_no_change_timeout_secondsis the soft limit after output stops changing, andterminal_max_output_sizetruncates terminal output returned to the agent. - Condense context. With
enable_condenser=true, OpenHands uses an LLM summarizing condenser.condenser_max_sizecontrols the maximum context event count, andcondenser_keep_firstpreserves the earliest events. - Run tools in the task workspace. Terminal actions execute through the selected AgentCompass environment. The harness keeps live state under
<workspace>/.agentcompass/, so partial history and an active terminal command or model request can still be recovered when a run times out. - Collect the submission. SWE-style tasks normally request a patch file such as
patch.txt; the first requested file collected successfully becomesfinal_answer. If no output file was requested, the OpenHands finish message is used instead.
Timeout layers
The timeout fields are independent and the first applicable limit to fire stops that operation:
For example, if
run_timeout_seconds=7200 and one model request has --model-params '{"timeout":9000}', the outer 7200-second task limit can still terminate the run first. When the outer timeout fires, RunResult is a run error, but partial trajectory and timeout diagnostics are retained when available.
Parameters
Pass a JSON object via--harness-params '{...}', or use harness.params in a YAML file given to --config; the CLI wins on shared keys. See the Harnesses overview for merge precedence.
Parameter reference
| Parameter | Type | Default | Choices / values | Description |
|---|---|---|---|---|
openhands_version | string | 1.23.0 | OpenHands SDK/tools version | Version installed into the isolated runtime. Keep it pinned for comparable runs. |
setup_capsule_tag | string | unset | python312-v1 | Optional predefined Python 3.12 Capsule used instead of micromamba runtime bootstrap. |
tool_preset | string | default | default / gemini / gpt5 / planning | OpenHands tool preset used by the agent. |
max_iterations | int | 250 | integer ≥ 1 | Maximum conversation iterations for one task. |
conversation_timeout | int | 3600 | integer ≥ 1 | Default timeout for one LLM request, in seconds. |
command_timeout | int / null | 1800 | integer ≥ 1 or null | Hard timeout for one terminal command, in seconds. |
terminal_no_change_timeout_seconds | int | 600 | integer ≥ 1 | Soft timeout after terminal output stops changing. |
terminal_max_output_size | int | 200000 | integer ≥ 1 | Maximum terminal-output characters returned to the agent. |
enable_condenser | bool | true | true / false | Enable the LLM summarizing condenser. |
interleaved_thinking | bool | false | true / false | Whether to include tool use and other reasoning state returned by the previous model request in the next request. |
condenser_max_size | int | 240 | integer ≥ 1 | Maximum event count before condenser processing. |
condenser_keep_first | int | 2 | integer ≥ 1 | Number of earliest events preserved by the condenser. |
skill_dirs | list | [] | directory paths | OpenHands skill directories. Paths must exist inside the execution environment. |
Model request parameters
--model-params is passed to the OpenHands SDK LLM constructor for both the main agent and the optional condenser. It is a separate JSON object from --harness-params.
A practical request and retry configuration is:
Thinking and reasoning
There is no OpenHands harness parameter namedthinking; configure reasoning under --model-params. Choose the form expected by the model server:
- Reasoning effort
- Responses API
- vLLM / Qwen thinking switch
- Anthropic extended thinking
Use OpenHands’ typed reasoning fields for a provider that supports reasoning effort:In particular, with
openai-chat, interleaved_thinking==true bypasses OpenHands’ model-name allowlist, preserves each assistant response’s reasoning_content, and sends it back to the server.max_output_tokens and the served context window together when necessary.
Run examples
- Default configuration
- Custom parameters
- Runtime Capsule
Run one SWE-bench Verified task using the default OpenHands parameters.
Output
The harness returns oneRunResult per task:
final_answer— the first requested output file, normally the submitted patch for SWE-style benchmarks;trajectory— the normalized OpenHands conversation and tool history, including partial history on supported timeout paths;artifacts.file— all requested files that were collected;artifacts.openhands— raw status, error, finish message, history, and OpenHands metrics;metrics— workspace, selected preset and model protocol, requested/resolved output paths, runtime status, and timeout diagnostics.
RUN_ERROR. The benchmark then stores the harness result with its evaluation data under the run directory’s details/ subdirectory; see Results.
Set the task execution deadline through --execution-params with run_timeout_seconds and run_timeout_multiplier. See phase timeouts.