Use the mini-SWE-agent Adapter

View as Markdown

Use the NVIDIA NeMo Fabric nvidia.fabric.mini-swe-agent adapter to run tasks with mini-SWE-agent.

Install the Adapter

To install the NVIDIA NeMo Fabric runtime, adapter, and supported mini-SWE-agent package in one environment, run:

pip install "nemo-fabric[mini-swe-agent]"

To install the adapter and supported mini-SWE-agent package without the NVIDIA NeMo Fabric runtime, use the harness extra:

pip install "nemo-fabric-adapters-mini-swe-agent[harness]"

The harness and full extras install the latest compatible mini-SWE-agent 2.x release. The full extra also installs the NeMo Relay Python package without the NeMo Relay CLI. To use an environment-managed compatible package, install the bare adapter:

pip install nemo-fabric-adapters-mini-swe-agent

For separate runtime and adapter environments, set ADAPTER_PYTHON in the runtime environment to the adapter environment’s Python interpreter. Use matching NVIDIA NeMo Fabric release versions for the runtime and adapter unless you have validated a different pairing.

Configure the Adapter

Select the mini-SWE-agent harness by adapter ID:

from nemo_fabric import HarnessConfig
harness = HarnessConfig(
adapter_id="nvidia.fabric.mini-swe-agent",
settings={"timeout": 30},
)

The adapter supports models, models.base_url, models.temperature, instructions.system with replace mode, runtime.max_turns, and environment.workspace. The adapter rejects append system instructions. Set models.<role>.api_key_env to the environment variable containing the model-provider credential.

runtime.timeout_seconds sets the NVIDIA NeMo Fabric invocation deadline. Use harness.settings.timeout to set the maximum duration of one command; the default is 30 seconds.

This adapter does not support MCP, skills, tool policy, or native OpenAI streaming.

Run a Task

import asyncio
from nemo_fabric import EnvironmentConfig, Fabric, FabricConfig, HarnessConfig
from nemo_fabric import InstructionConfig, InstructionsConfig, MetadataConfig
from nemo_fabric import ModelConfig, RuntimeConfig
config = FabricConfig(
metadata=MetadataConfig(name="mini-swe-agent"),
harness=HarnessConfig(
adapter_id="nvidia.fabric.mini-swe-agent",
settings={"timeout": 30},
),
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="Inspect the issue and verify the change.")
),
runtime=RuntimeConfig(max_turns=50, timeout_seconds=1800),
environment=EnvironmentConfig(provider="local", workspace="/workspace"),
)
async def main():
return await Fabric().run(
config, base_dir="/workspace", input="Fix the failing test."
)
result = asyncio.run(main())

The result includes the submitted final output and API-call usage.

Continue a Task Across Invocations

Use one runtime to retain mini-SWE-agent conversation history across ordered invocations:

async with await Fabric().start_runtime(
config,
base_dir="/workspace",
) as runtime:
first = await runtime.invoke(
input="Inspect calculator.py and identify the bug."
)
second = await runtime.invoke(input="Fix it and run the tests.")

Before the second model call, the adapter removes the previous terminal exit message and appends the new input as a user message. Earlier system, user, assistant, and bash tool observation messages remain in the model context, including command output. History lasts only for the same runtime and is discarded when the runtime stops. The adapter does not currently truncate or summarize retained history.

Stream Relay Telemetry

Install the runtime, mini-SWE-agent harness, and NeMo Relay Python package in one environment:

pip install "nemo-fabric[mini-swe-agent,relay]"

Enable Relay on the configuration:

config.enable_relay()

For a Relay-enabled runtime, the adapter selects a Relay-specific mini-SWE-agent subclass that emits invocation, step, model, and bash-action events. Relay is not imported and the subclass is not used when Relay is disabled.

Use Fabric.start_runtime(config, streaming=True) and Runtime.invoke_stream() to receive correlated ATOF records while ordinary adapter invoke() runs. This Relay-backed stream is independent of native OpenAI streaming; capabilities.streaming remains false.