> This page is for NeMo Fabric, version dev.
> For other versions, use one of these documentation indexes:
> - Latest (v0.4.0) (default): https://docs.nvidia.com/nemo/fabric/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/fabric/dev/llms.txt
> - v0.5.0: https://docs.nvidia.com/nemo/fabric/v0.5.0/llms.txt
> - v0.4.0: https://docs.nvidia.com/nemo/fabric/v0.4.0/llms.txt
> - v0.3.0: https://docs.nvidia.com/nemo/fabric/v0.3.0/llms.txt
> - v0.2.0: https://docs.nvidia.com/nemo/fabric/v0.2.0/llms.txt
> - v0.1.1: https://docs.nvidia.com/nemo/fabric/v0.1.1/llms.txt
> - v0.1.0: https://docs.nvidia.com/nemo/fabric/v0.1.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/fabric/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/fabric/_mcp/server.

# Use the OpenHands Adapter

> Install and configure the NVIDIA NeMo Fabric harness integration for OpenHands.

Use the NVIDIA NeMo Fabric `nvidia.fabric.openhands` adapter to run tasks with
the OpenHands SDK. The adapter keeps one OpenHands conversation alive for each
NeMo Fabric runtime, so ordered invocations retain conversation context.

## Install the Adapter

Install the tested OpenHands packages, then install the runtime and adapter:

```bash
pip install "openhands-sdk==1.50.0" "openhands-tools==1.50.0"
pip install "nemo-fabric[openhands]"
```

The 1.50.0 package pair is validated with NVIDIA NIM.

To install only the adapter, use:

```bash
pip install nemo-fabric-adapters-openhands
```

The adapter package supports Python 3.11 or later, while OpenHands requires
Python 3.12 or later. The adapter packages do not install OpenHands.

## Configure the Adapter

```python
from nemo_fabric import EnvironmentConfig, FabricConfig, HarnessConfig
from nemo_fabric import InstructionConfig, InstructionsConfig, ModelConfig
from nemo_fabric import RuntimeConfig, ToolsConfig

config = FabricConfig(
    harness=HarnessConfig(adapter_id="nvidia.fabric.openhands"),
    models={
        "default": ModelConfig(
            provider="nvidia",
            model="nvidia/nemotron-3-nano-omni-30b-a3b-reasoning",
            api_key_env="NVIDIA_API_KEY",
            base_url="https://integrate.api.nvidia.com/v1",
        )
    },
    instructions=InstructionsConfig(
        system=InstructionConfig(
            content="Review the requested code change.",
            mode="append",
        )
    ),
    tools=ToolsConfig(enabled=["terminal", "file_editor"]),
    runtime=RuntimeConfig(max_turns=20),
    environment=EnvironmentConfig(provider="local", workspace="."),
)
```

The adapter maps normalized model settings, `replace` and `append` system
instructions, `runtime.max_turns`, tool policy, MCP servers, skills, and the
workspace. Supported tool names are `terminal` (alias `bash`) and
`file_editor` (alias `edit`). OpenHands retains its internal finish and
reasoning tools.

Skill paths resolve from the configuration base directory and must contain a
`SKILL.md` file. The adapter disables ambient OpenHands user, public, project,
and memory loading, so only explicitly configured NeMo Fabric skills load.

The adapter configures the OpenHands SDK standard summarizing condenser,
`default_condenser`, with the agent model. When the history sent to the model
exceeds 80 events, or exceeds the model input token limit when OpenHands knows
it, OpenHands replaces older events with a model-generated summary and keeps
the first 4 events. When the model rejects a request for exceeding its context
window, OpenHands condenses the history and continues instead of failing the
invocation. Summarization calls count toward invocation usage, and each
condensation step counts toward `runtime.max_turns`. NeMo Fabric does not
expose condenser tuning parameters.

To keep the full conversation history and make no summarization calls, set the
`condenser` harness setting to `none`. The default value, `default`, enables
the condenser, and any other value is rejected. The following example turns
the condenser off:

```python
from nemo_fabric import HarnessConfig

harness = HarnessConfig(
    adapter_id="nvidia.fabric.openhands",
    settings={"condenser": "none"},
)
```

The initial integration does not support Relay telemetry, native streaming,
interactive confirmation, MCP authentication, or per-server MCP tool filters.

## Understand the Runtime Lifecycle

The adapter runs the OpenHands SDK directly in a persistent Python adapter
process. It does not start or connect to an OpenHands server. `start` creates
one local conversation for the NeMo Fabric runtime, and ordered invocations
reuse that conversation and its history.

```mermaid
flowchart TD
  Fabric["NeMo Fabric runtime"] -->|"NDJSON over stdio"| Adapter
  subgraph Python["One persistent Python adapter process"]
    Adapter["OpenHands adapter"] --> SDK["OpenHands SDK"]
    SDK --> Conversation["One local conversation"]
  end
  Conversation --> Provider["Model-provider endpoint"]
  Conversation --> MCP["Configured MCP servers"]
  Conversation --> Workspace["NeMo Fabric workspace"]
```

Each invocation returns only the final response and usage for that turn. `stop`
closes the conversation and removes the adapter-owned temporary profile state.
Create a new runtime to change the model, workspace, tools, MCP servers, or
skills.

## Run the Code Review Example

Set `NVIDIA_API_KEY`. For a source checkout, also point NeMo Fabric at the Python
environment that contains the adapter and OpenHands packages:

```bash
export ADAPTER_PYTHON="$PWD/.venv/bin/python"
```

Then run:

```bash
.venv/bin/python -m examples.code_review_agent \
  --variant openhands \
  --input "Review calculator.py" \
  --show-output
```

Do not combine the OpenHands variant with `--relay`.