Integrate NVIDIA NeMo Fabric Through The Python SDK
Use this skill when a consumer codebase — an application, service, evaluation
harness, or platform — needs to run agent harnesses through NeMo Fabric's typed
Python SDK. The consumer owns its own configuration object and translates it
into an in-memory FabricConfig; NeMo Fabric owns adapter selection, the runtime
lifecycle, and normalized results.
Integration Boundary
Use the public, in-memory contract. These rules keep a consumer integration
supported and upgrade-safe:
- Import only from the public
nemo_fabricpackage. Never import_nativeor
any adapter-internal module.
- Build configuration as a typed
FabricConfigin memory and pass it directly to
NeMo Fabric. Create every deployment or evaluation variant with ordinary Python
functions and model_copy(deep=True). A platform integration can serialize
the typed config inside a private transient run specification when it crosses
a process boundary; that transport is not a public authoring format.
- Let NeMo Fabric own harness control. Do not reimplement start, invoke, or stop
logic, and do not manage adapter threads, sessions, or processes directly.
- Treat
runtime_id,invocation_id, andrequest_idas opaque correlation
strings, not parsable or reusable state.
Refer to config-mapping.md for how to translate a
consumer config object into FabricConfig, and for the full list of mechanics
that stay hidden behind this boundary.
Install And Set Up The Environment
The consumer or its execution environment owns installation; NeMo Fabric validates
runtime assumptions but never installs harnesses or credentials at run time.
- Choose supported Python interpreters for the runtime, Harbor, and adapter
environments from the
- Install the runtime with
uv pip install nemo-fabric(add theharborextra
for the Harbor integration).
- Select the harness adapter through
HarnessConfig.adapter_id. To install the
NeMo Fabric runtime, adapter, and supported harness in one environment, use
nemo-fabric[claude], nemo-fabric[codex],
or nemo-fabric[deepagents].
- Install Hermes Agent separately from the Fabric adapter. Follow the
for the current compatible interpreter, source checkout, Relay dependencies,
and adapter installation. The nemo-fabric[hermes-agent] extra does not
install Hermes Agent.
- In a separate adapter environment, install
nemo-fabric-adapters-<adapter>[harness]. This installs the adapter and
supported harness dependencies without the NeMo Fabric runtime. Use full
instead when that adapter package provides package-installable optional
integrations.
- Point the runtime to a separate adapter environment with
ADAPTER_PYTHON.
Use matching NeMo Fabric release versions for the runtime and adapter package
unless a different pairing has been explicitly validated.
- If the adapter environment already manages a compatible harness, install the
bare nemo-fabric-adapters-<adapter> distribution. Bare adapter
distributions contain only adapter-owned runtime dependencies.
- LangChain Deep Agents and Hermes adapter packages provide
relayand include
the NeMo Relay Python package in full. Claude and Codex do not provide
relay; their harness and full extras install the supported nemo-relay
CLI alongside the harness SDK.
- Provide model credentials through environment variables named by the config
(ModelConfig.api_key_env), never as literals in code.
- Forward other existing variables with
EnvironmentConfig.env_names; only names are stored in configuration and run plans.EnvironmentConfig.envsupplies literal values and does not expand$NAMEreferences. Neither field loads a.envfile. - Keep named environment values unchanged while a runtime or service is active. NeMo Fabric rejects changed or unset values before invocation; restart the runtime and any associated service after changing them. With Harbor, deliver values into the task environment through Harbor's managed environment first.
- Confirm the native extension is importable; SDK calls raise
FabricNativeUnavailableError when it is missing.
- For descriptor inspection without harness SDKs, install the separate
nemo-fabric-adapter-catalogpackage and callnemo_fabric_adapter_catalog.get_adapter_descriptor(adapter_id)orget_target_descriptor(target_id). Refer to the catalog guide. Catalog resources do not register execution runners; unknown IDs raiseKeyError. Validate against the task environment's descriptor before relying on a snapshot claim. Catalog source versions and fingerprints are not runtime-observed provenance.
Build The Typed Config From Consumer Config
Map the consumer's application, job, or deployment object into a FabricConfig
with the public models and helper methods:
from nemo_fabric import (
FabricConfig,
HarnessConfig,
InstructionConfig,
InstructionsConfig,
MetadataConfig,
ModelConfig,
RuntimeConfig,
ToolsConfig,
)
def to_tools_config(job) -> ToolsConfig | None:
enabled = job.enabled_tools
blocked = list(job.blocked_tools)
if enabled is None and not blocked:
return None
return ToolsConfig(
enabled=None if enabled is None else list(enabled),
blocked=blocked,
)
def to_fabric_config(job) -> FabricConfig:
config = FabricConfig(
metadata=MetadataConfig(name=job.name),
harness=HarnessConfig(adapter_id=job.adapter_id, resolution="preinstalled"),
models={
"default": ModelConfig(
provider=job.provider,
model=job.model,
api_key_env=job.api_key_env,
base_url=job.base_url,
)
},
instructions=(
InstructionsConfig(
system=InstructionConfig(
content=job.system_instruction,
mode=job.system_instruction_mode,
),
)
if job.system_instruction is not None
else None
),
runtime=RuntimeConfig(
input_schema="chat",
output_schema="message",
timeout_seconds=job.timeout_seconds,
max_turns=job.max_turns,
),
tools=to_tools_config(job),
)
config.add_skill_path(job.skill_dir)
config.add_mcp_server(
"github",
transport="streamable-http",
url="${GITHUB_MCP_URL}",
exposure="harness_native",
)
return config
- Shape capabilities with
ToolsConfig,add_tool_definition,block_tools,add_skill_path,
remove_skill_path,
add_mcp_server, remove_mcp_server, and enable_relay.
- Use
add_tool_definitiononly when the selected adapter accepts
tools.definitions and publishes a tool_definition_schema. The LangChain
Deep Agents adapter accepts kind="python" with ref="package.module:attribute"
naming an installed LangChain BaseTool instance or subclass, and accepts
custom AgentMiddleware classes in harness.settings.deepagents.middleware.
- Use a restricted
allowed_toolslist or non-emptyblocked_toolson
add_mcp_server only when the selected adapter declares both mcp and
mcp.tool_filters. An unfiltered server requires only mcp.
allowed_tools=None exposes every discovered tool, while an empty list
exposes none; blocked tools are removed after applying that allowlist. Tool
names must be non-blank, and planning rejects a tool that appears in both
lists.
- Configure MCP authentication only when the selected adapter declares
mcp.auth.oauth2 or mcp.auth.service_account, matching the authentication
type.
- Create deployment or evaluation variants with
model_copy(deep=True)and
ordinary Python functions; each copy plans and runs independently.
- To give a skill path the same meaning on every adapter, set
SkillConfig.directories to SkillDirectory(skill=...) and
SkillDirectory(folder=...) entries instead of using paths, with optional
bundled=BundledSkills(...) and
duplicates. These need adapter support, and add_skill_path raises
ValueError once directories is set. Refer to
- Pass
base_dir=...to anyFabriccall when the config uses relative paths,
so skills, workspaces, and artifacts anchor to the consumer's own layout.