Skip to main content

Python bindings for the NeMo Relay agent runtime.

Project description

License GitHub Release Codecov PyPI npm node npm wasm Crates.io Crates.io Crates.io Ask DeepWiki

NeMo Relay

nemo-relay is the NeMo Relay package for Python applications. It gives Python code access to a portable agent runtime for execution scopes, middleware, plugins, lifecycle events, adaptive behavior, and observability around tool and LLM calls.

The package wraps the shared Rust runtime, so Python applications use the same runtime semantics as the Rust and Node.js surfaces.

Why Use It?

  • 🧭 Own execution context in Python: Group agent, tool, and LLM work into one scope tree from Python application code.
  • 🛡️ Package policy around callbacks: Use guardrails and intercepts to block work, sanitize observability payloads, rewrite requests, or wrap execution.
  • 📡 Emit one lifecycle stream: Send runtime events to in-process subscribers, Agent Trajectory Interchange Format (ATIF), OpenTelemetry, or OpenInference workflows.
  • 🧩 Integrate without a framework migration: Wrap framework or provider callbacks while preserving the application’s orchestration model.

What You Get

  • Scope, tool, and LLM helpers: Managed boundaries that emit lifecycle events and run middleware in a consistent order.
  • Middleware APIs: Guardrails and intercepts for tool and LLM requests, responses, and execution.
  • Subscribers and exporters: Event consumers for observability and diagnostics.
  • Plugin and typed helpers: Public modules for plugins, codecs, typed wrappers, adaptive runtime behavior, and observability plugin configuration.
  • Shared Rust runtime semantics: Python behavior aligned with the Rust and Node.js surfaces.

Installation

Install the published package with uv:

uv add nemo-relay

If you are not using uv, install it with pip:

pip install nemo-relay

Optional Dependencies

LangChain Integration

LangChain integration is available with the langchain extra:

# With uv
uv add "nemo-relay[langchain]"

# With pip
pip install "nemo-relay[langchain]"

LangGraph Integration

LangGraph integration is available with the langgraph extra, this builds upon and includes the langchain extra as well.

# With uv
uv add "nemo-relay[langgraph]"

# With pip
pip install "nemo-relay[langgraph]"

Deep Agents Integration

Deep Agents integration is available with the deepagents extra. This extra builds upon and includes the langgraph and langchain extras.

# With uv
uv add "nemo-relay[deepagents]"

# With pip
pip install "nemo-relay[deepagents]"

LangChain NVIDIA Integration

The LangChain NVIDIA extra builds upon the langchain extra adding a compatible version of the langchain-nvidia-ai-endpoints package.

# With uv
uv add "nemo-relay[langchain-nvidia]"

# With pip
pip install "nemo-relay[langchain-nvidia]"

To install this along with the langgraph extra, use:

# With uv
uv add "nemo-relay[langgraph,langchain-nvidia]"
# With pip
pip install "nemo-relay[langgraph,langchain-nvidia]"

Getting Started

Register a subscriber, create a scope, and emit a mark event:

import nemo_relay


def on_event(event) -> None:
    print(f"{event.kind} {event.name}")


nemo_relay.subscribers.register("printer", on_event)

with nemo_relay.scope.scope("demo-agent", nemo_relay.ScopeType.Agent) as handle:
    nemo_relay.scope.event("initialized", handle=handle, data={"binding": "python"})

nemo_relay.subscribers.deregister("printer")

For host integrations that need a serialized event shape, consume the canonical JSON payload from the subscriber event object:

import json
import nemo_relay


def on_event(event) -> None:
    payload = event.to_dict()
    print(payload["kind"], payload["name"])
    assert json.loads(event.to_json()) == payload


nemo_relay.subscribers.register("host-exporter", on_event)
try:
    with nemo_relay.scope.scope("demo-agent", nemo_relay.ScopeType.Agent):
        nemo_relay.scope.event("initialized", data={"binding": "python"})
finally:
    nemo_relay.subscribers.deregister("host-exporter")

Package Surface

The public package modules are:

  • nemo_relay.scope
  • nemo_relay.tools
  • nemo_relay.llm
  • nemo_relay.guardrails
  • nemo_relay.intercepts
  • nemo_relay.subscribers
  • nemo_relay.plugin
  • nemo_relay.adaptive
  • nemo_relay.observability
  • nemo_relay.typed
  • nemo_relay.codecs

Integrations

  • nemo_relay.integrations.langchain
  • nemo_relay.integrations.langgraph
  • nemo_relay.integrations.deepagents

The compiled extension is exposed as nemo_relay._native.

Documentation

NeMo Relay Documentation: https://nvidia.github.io/NeMo-Relay

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nemo_relay-0.3.0b2-cp311-abi3-win_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11+Windows ARM64

nemo_relay-0.3.0b2-cp311-abi3-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.11+Windows x86-64

nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

nemo_relay-0.3.0b2-cp311-abi3-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file nemo_relay-0.3.0b2-cp311-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for nemo_relay-0.3.0b2-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 0996f556cfdf5aa260a99d081a15604124e11eb6fa9f6ae9fc530b5f9f92e7ff
MD5 926253ddc42fd009fa6c1dff71de598a
BLAKE2b-256 665fd309377b0714eaa1ce7e50b3f59508c57eed5d4f747c0ad05e7aac5d8647

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemo_relay-0.3.0b2-cp311-abi3-win_arm64.whl:

Publisher: ci.yaml on NVIDIA/NeMo-Relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nemo_relay-0.3.0b2-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: nemo_relay-0.3.0b2-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for nemo_relay-0.3.0b2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 477fd24f13ba835ab6bf691422306d0f5fefc74f574446a73bac99663cd2d269
MD5 2831439d273e544c6a435edaf4443b90
BLAKE2b-256 ca46805bceb13f7569f759f269eae7dd77fb37785365b1f88f375ebfbf9d533a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemo_relay-0.3.0b2-cp311-abi3-win_amd64.whl:

Publisher: ci.yaml on NVIDIA/NeMo-Relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94fce81a562eda66f56b278bd085cc39f8067a6352781ec5bd907ab032f2d5a9
MD5 ca17e701f48b86ad792b6dd84aa59ab4
BLAKE2b-256 6c35526155f70849585b9c60c03ef631afdccff6df9a5a0f2ecddbe4b211da6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yaml on NVIDIA/NeMo-Relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 302fd015d6e39ea14cd5651c777d7e2abd585c2d56125ae33ebb5c8069ea979a
MD5 701aee6fc6a6b878e343542544555043
BLAKE2b-256 60f686356a0b451b0d76c12100a65b2b30e93986f37dfaa35d74938aeb8d23b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemo_relay-0.3.0b2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: ci.yaml on NVIDIA/NeMo-Relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nemo_relay-0.3.0b2-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nemo_relay-0.3.0b2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 463ad697bf8763c111777ce3bcb991cad8f7fbc1c4d26a6ae7af07ddf65d88e1
MD5 35e30540dc5069459322a0583e89de30
BLAKE2b-256 68ad98a20ec2f65e762610958e655536a0f75a6574b7d2b041038c31f85e138b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemo_relay-0.3.0b2-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: ci.yaml on NVIDIA/NeMo-Relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page