> ## Documentation Index
> Fetch the complete documentation index at: https://agent-compass.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ResearchHarness

The `researchharness` harness runs [ResearchHarness](https://github.com/InternScience/ResearchHarness) as a research agent inside a prepared environment. It runs [ResearchClawBench](https://agent-compass.mintlify.site/en/user_guide/modules/benchmarks/researchclawbench.md) and other long-form research benchmarks such as [SGI Deep Research](https://agent-compass.mintlify.site/en/user_guide/modules/benchmarks/sgi_deep_research.md).

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](https://agent-compass.mintlify.site/en/developer_guide/extensions/benchmark/code_implementation/shared_contracts.md#task-environment-variables).

## How it works

* **Prepare ResearchHarness.** According to `install_strategy`, the harness uses an existing package or runs `install_command`. The installed package must be ResearchHarness 0.0.49 or later.
* **Run the research loop.** AgentCompass injects a runner into the task environment, passes the prepared prompt and workspace, and launches the ResearchHarness agent. `max_rounds` limits agent rounds, while `execution.run_timeout_seconds` limits the maximum runtime of one task.
* **Configure retrieval services.** Serper powers web and scholar search, Jina fetches web content, and MinerU parses PDF documents. Their credentials are supplied by dedicated harness parameters or same-named environment variables.
* **Collect results.** The harness converts ResearchHarness events into the standard trajectory, final answer, execution status, and requested output files in `RunResult`.

## Parameters

Pass harness configuration with `--harness-params '{...}'`, or place it under `harness.params` in the YAML supplied to `--config`; command-line values take precedence.

### Parameter reference

<table>
  <thead>
    <tr><th>Parameter</th><th>Type</th><th>Default</th><th>Choices / values</th><th>Description</th></tr>
  </thead>

  <tbody>
    <tr><td>`install_strategy`</td><td>string</td><td>`install_if_missing`</td><td>`preinstalled` / `install_if_missing` / `install_always`</td><td>How to prepare the ResearchHarness package.</td></tr>
    <tr><td>`install_command`</td><td>string</td><td>shown below</td><td>shell command</td><td>Command used when the selected strategy installs the package.</td></tr>
    <tr><td>`install_timeout`</td><td>int / null</td><td>`900`</td><td>integer ≥ 1 / `null`</td><td>Install-command timeout in seconds.</td></tr>
    <tr><td>`max_rounds`</td><td>int</td><td>`500`</td><td>integer ≥ 1</td><td>Maximum agent rounds for one task.</td></tr>
    <tr><td>`llm_request_timeout_seconds`</td><td>int</td><td>`1200`</td><td>integer ≥ 1</td><td>Timeout for one model request in seconds.</td></tr>
    <tr><td>`webfetch_tool_timeout_seconds`</td><td>int</td><td>`300`</td><td>integer ≥ 1</td><td>Timeout for one WebFetch call in seconds.</td></tr>
    <tr><td>`readpdf_tool_timeout_seconds`</td><td>int</td><td>`300`</td><td>integer ≥ 1</td><td>Timeout for one ReadPDF call in seconds.</td></tr>
    <tr><td>`max_output_tokens`</td><td>int</td><td>`16384`</td><td>integer ≥ 1</td><td>Maximum output tokens for one model request.</td></tr>
    <tr><td>`max_input_tokens`</td><td>int</td><td>`131072`</td><td>integer ≥ 1</td><td>Maximum input tokens for one model request.</td></tr>
    <tr><td>`compact_trigger_tokens`</td><td>string</td><td>`96k`</td><td>positive integer or `k` suffix</td><td>Token threshold that triggers context compaction.</td></tr>
    <tr><td>`serper_api_key`</td><td>string</td><td>`${SERPER_API_KEY}`</td><td>API key or environment reference</td><td>Credential used by web and scholar search.</td></tr>
    <tr><td>`jina_api_key`</td><td>string</td><td>`${JINA_API_KEY}`</td><td>API key or environment reference</td><td>Credential used to fetch web content.</td></tr>
    <tr><td>`mineru_token`</td><td>string</td><td>`${MINERU_TOKEN}`</td><td>token or environment reference</td><td>Credential used to parse PDF documents.</td></tr>
    <tr><td>`extra_tools`</td><td>list</td><td>`[]`</td><td>tool-name list</td><td>Additional ResearchHarness tools, for example `str_replace_editor`.</td></tr>
  </tbody>
</table>

The default `install_command` is:

```bash theme={"system"}
python3 -m pip install researchharness
```

### Retrieval and parsing API keys

`serper_api_key`, `jina_api_key`, and `mineru_token` default to `${SERPER_API_KEY}`, `${JINA_API_KEY}`, and `${MINERU_TOKEN}`. Set those variables in the process that starts AgentCompass, or pass explicit values through `--harness-params`. Dedicated parameters take precedence over generic environment overrides.

## Run examples

> [tab] Default configuration
>
> Set `SERPER_API_KEY`, `JINA_API_KEY`, and `MINERU_TOKEN` in the shell, then run ResearchClawBench with the ResearchHarness defaults.
>
> ```bash theme={"system"}
> agentcompass run \
>   researchclawbench \
>   researchharness \
>   "$MODEL_NAME" \
>   --env host_process \
>   --benchmark-params '{
>     "judge_model": {"id": "your-judge-model", "base_url": "https://your-judge-endpoint/v1", "api_key": "sk-…", "api_protocol": "openai-chat"}
>   }' \
>   --model-base-url "$MODEL_BASE_URL" \
>   --model-api-key "$MODEL_API_KEY"
> ```

> [tab] Custom parameters
>
> Set explicit research limits and pass the external-service credentials through harness parameters.
>
> ```bash theme={"system"}
> agentcompass run \
>   researchclawbench \
>   researchharness \
>   "$MODEL_NAME" \
>   --env host_process \
>   --benchmark-params '{
>     "judge_model": {"id": "your-judge-model", "base_url": "https://your-judge-endpoint/v1", "api_key": "sk-…", "api_protocol": "openai-chat"}
>   }' \
>   --harness-params '{"max_rounds": 600, "llm_request_timeout_seconds": 1800, "serper_api_key": "${SERPER_API_KEY}", "jina_api_key": "${JINA_API_KEY}", "mineru_token": "${MINERU_TOKEN}"}' \
>   --execution-params '{"run_timeout_seconds": 14400}' \
>   --model-base-url "$MODEL_BASE_URL" \
>   --model-api-key "$MODEL_API_KEY"
> ```

## Output

For each task, ResearchHarness returns a `RunResult` containing the execution status, final answer, normalized trajectory, requested output files, and raw ResearchHarness events and logs. The selected benchmark writes aggregate metrics and per-task details under the [run directory](https://agent-compass.mintlify.site/en/user_guide/other_features/results/overview.md#directory-layout); see [Results](https://agent-compass.mintlify.site/en/user_guide/other_features/results/overview.md).

Set the task execution deadline through `--execution-params` with `run_timeout_seconds` and `run_timeout_multiplier`. See [phase timeouts](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/timeouts.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.