Use the Qwen Code Adapter
Use the nvidia.fabric.qwen adapter to run tasks with Qwen Code. Each NVIDIA
NeMo Fabric runtime uses @qwen-code/sdk to start one bundled Qwen CLI child
process and reuses one live session across ordered invocations. Qwen Code runs
as a separate process; it is not embedded in the adapter process.
Install the Adapter
Install Node.js 22.19 or later. Then install the adapter and its exact-pinned, consumer-managed SDK in the project that owns the NeMo Fabric configuration:
The SDK is an optional peer and bundles the Qwen CLI. Installing the adapter
alone does not install it. Starting the adapter without the compatible SDK
returns qwen_sdk_missing.
For source development, run these commands from the repository root:
Configure the Adapter
Select the Qwen Code integration and point discovery at the installed adapter descriptor:
Set NVIDIA_API_KEY before starting the runtime. For a source build, set
discovery.local_paths to
adapters/typescript/qwen/qwen.fabric-adapter.json instead. The build commands
above create the descriptor’s dist/cli.js runner.
Supported Configuration
The adapter supports the following normalized configuration:
- Models: Selects the
defaultrole, or the only configured role. It mapsmodel,api_key_env,base_url,temperature, andtop_pfor theopenaiprovider. - Instructions: Supports
instructions.systemwithmode: replaceormode: append. - Tools: Maps Qwen-native tool names from
tools.blocked. Tool definitions andtools.enabledare unsupported. - Skills: Each
skills.pathsentry must be a directory containingSKILL.md. - MCP: Supports stdio and streamable HTTP servers, including per-server allowed and blocked tool filters.
- Harness settings: Maps
permission_modeto Qwen Code’sdefault,plan,auto-edit,auto, oryoloapproval mode.
Model Endpoints
The adapter requires models.<role>.provider: openai. When base_url is set,
it must identify an OpenAI-compatible Chat Completions endpoint. Remote
endpoints require HTTPS, with HTTP allowed for loopback development servers.
The adapter reads the variable named by api_key_env from NeMo Fabric
environment.env first and then the parent process environment. It does not
write the credential to Qwen settings.
MCP Configuration
Stdio servers map url to the executable and may define args and env, but
not HTTP headers. Streamable HTTP servers may define custom_headers, but not
process arguments or environment variables. Remote MCP endpoints require HTTPS
except for loopback development endpoints.
Header values may reference ${NAME}. Resolution checks NeMo Fabric
environment.env first and then the parent process environment. Unresolved
references fail startup. allowed_tools and blocked_tools map to Qwen Code’s
per-server filters. Normalized MCP authentication is unsupported.
Only explicitly configured server names are enabled. The pinned SDK discovers
external MCP servers on the first prompt and does not include them in
mcpServerStatus(). The adapter captures the SDK’s MCP startup diagnostic and
returns qwen_mcp_unavailable instead of accepting a result produced without
every explicitly configured server.
Runtime Behavior
The adapter accepts plain-text input and returns the terminal assistant text in
output.response. Qwen Code reports cumulative usage for a live query, so the
adapter returns the per-invocation difference. Create a new runtime to change
the selected model, workspace, system instructions, skills, MCP servers, tool
policy, or permission mode.
The adapter gives the child process isolated temporary Qwen home and runtime
directories. It disables Qwen Code’s optional product-usage analytics and
telemetry. This does not affect model-provider metering or token usage reported
by NeMo Fabric. The adapter also disables extensions, ambient skills, and
ambient MCP servers. Explicit NeMo Fabric environment.env values and the
selected model credential are forwarded to the child process.
In SDK mode, set harness.settings.permission_mode to control Qwen Code’s
permission policy. The default value, default, denies tool calls that need
interactive approval. Use auto for Qwen’s classifier-mediated policy. Use
yolo only inside an appropriate task sandbox because it bypasses edit
approval. Qwen’s permission policy is not a filesystem sandbox.
models.max_tokens, provider-specific model settings, runtime.max_turns,
tools.enabled, native streaming, cancellation, service mode, and Relay
telemetry are unsupported.
Understand the Runtime Lifecycle
The adapter runs as a persistent Node.js process, but the Qwen Code harness does
not run in-process. start creates isolated configuration and asks
@qwen-code/sdk to launch its bundled Qwen CLI as a child process. The SDK
exchanges JSON-lines messages with the CLI over stdin and stdout. stop closes
the live query, terminates the child process, and removes the temporary profile.
To try the source adapter, use the code-review agent Qwen variant.