> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server. # nemo_relay > Python bindings for the NeMo Relay runtime. Generated from `python/nemo_relay/__init__.pyi`. Module `nemo_relay`. Python bindings for the NeMo Relay runtime. ## Classes ### `DataSchema(TypedDict)` Schema identifier attached to an event's opaque data payload. ### `EventSanitizeFields(TypedDict)` Observability fields returned by mark and scope event sanitizers. ## Functions ### `get_scope_stack` ```python def get_scope_stack() -> ScopeStack ``` Return the current task's active scope stack. ### `scope_stack_active` ```python def scope_stack_active() -> bool ``` Report whether the current context already owns a scope stack. ### `propagate_scope_to_thread` ```python def propagate_scope_to_thread() -> ScopeStack ``` Capture the active scope stack for use in another thread. ### `create_scope_stack` ```python def create_scope_stack() -> ScopeStack ``` Create a new isolated scope stack. ### `capture_propagation_context` ```python def capture_propagation_context() -> PropagationContext ``` Capture the current Relay causal parent for application-managed transport. ### `capture_propagation_context_with_root` ```python def capture_propagation_context_with_root(root_uuid: str | None) -> PropagationContext ``` Capture the current parent with an optional stable application session root. ### `capture_traceparent` ```python def capture_traceparent() -> str ``` Capture the current Relay context as a W3C `traceparent` value. ### `create_scope_stack_from_propagation` ```python def create_scope_stack_from_propagation(context: PropagationContext) -> ScopeStack ``` Create an isolated stack seeded from a received propagation context. ### `fork_asyncio_context` ```python def fork_asyncio_context() -> contextvars.Context ``` Create an asyncio child context with an isolated Relay scope stack. ### `use_scope_stack` ```python def use_scope_stack(stack: ScopeStack) ``` Temporarily install `stack` in the current Python context. ### `set_thread_scope_stack` ```python def set_thread_scope_stack(stack: ScopeStack) -> None ``` Install a scope stack into the current thread's native runtime context. ## Type Aliases And Constants * `Event` * `EventMetadata` * `EventMetadataInjectorCallback` * `EventMetadataScalar` * `EventMetadataValue` * `EventSanitizeGuardrail` * `Json` * `JsonObject` * `JsonPrimitive` * `JsonValue` * `LlmConditionalExecutionGuardrail` * `LlmExecutionIntercept` * `LlmRequestIntercept` * `LlmSanitizeRequestGuardrail` * `LlmSanitizeResponseGuardrail` * `LlmStreamExecutionIntercept` * `ToolConditionalExecutionGuardrail` * `ToolExecutionIntercept` * `ToolRequestIntercept` * `ToolSanitizeGuardrail` * `UnsupportedBehavior` ## Re-exports * `AnnotatedLLMRequest` * `AnnotatedLLMResponse` * `AtifExporter` * `AtofExporter` * `AtofExporterConfig` * `AtofExporterMode` * `AtofStreamSinkConfig` * `LLMAttributes` * `LLMHandle` * `LLMRequest` * `LLMRequestInterceptOutcome` * `LlmCodecIdentity` * `LlmSanitizeRequestCodec` * `LlmSanitizeRequestContext` * `LlmSanitizeResponseCodec` * `LlmSanitizeResponseContext` * `LogSeverity` * `MarkEvent` * `MetricKind` * `MetricMeasurement` * `MetricTemporality` * `MetricValueType` * `OpenTelemetryConfig` * `OpenTelemetryLogConfig` * `OpenTelemetryLogSubscriber` * `OpenTelemetryMetricConfig` * `OpenTelemetryMetricSubscriber` * `OpenTelemetryRuntimeDiagnostic` * `OpenTelemetryRuntimeDiagnostics` * `OpenTelemetrySubscriber` * `PendingMarkSpec` * `PropagationContext` * `ScopeAttributes` * `ScopeEvent` * `ScopeHandle` * `ScopeStack` * `ScopeType` * `ToolAttributes` * `ToolExecutionInterceptOutcome` * `ToolExecutionResult` * `ToolHandle` * `adaptive` * `codecs` * `event_metadata` * `guardrails` * `intercepts` * `llm` * `model_pricing` * `observability` * `pii_redaction` * `plugin` * `scope` * `scope_local` * `subscribers` * `tools` * `typed` > Python bindings for the NeMo Relay runtime. ## Docs - [nemo_relay.adaptive](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/adaptive.md): Adaptive plugin configuration helpers. - [nemo_relay.codecs](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/codecs.md): Protocol definitions for request and response codecs used by `nemo_relay.llm`. - [nemo_relay.event_metadata](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/event-metadata.md): Global event metadata injector registration. - [nemo_relay.guardrails](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/guardrails.md): Global guardrail registration for tools and LLMs. - [nemo_relay.integrations](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations.md): Optional integrations for NeMo Relay. - [nemo_relay.integrations.deepagents](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/deepagents.md): NeMo Relay integrations for Deep Agents. - [nemo_relay.integrations.deepagents.callbacks](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/deepagents/callbacks.md): Deep Agents callback handler for NeMo Relay observability. - [nemo_relay.integrations.deepagents.middleware](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/deepagents/middleware.md): Deep Agents middleware for NeMo Relay observability. - [nemo_relay.integrations.langchain](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/langchain.md): NeMo Relay integrations for LangChain. - [nemo_relay.integrations.langchain.callbacks](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/langchain/callbacks.md): LangChain callback handler that maps run hierarchy to NeMo Relay scopes. - [nemo_relay.integrations.langchain.middleware](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/langchain/middleware.md): LangChain AgentMiddleware implementation for NeMo Relay. - [nemo_relay.integrations.langgraph](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/langgraph.md): NeMo Relay integrations for LangGraph. - [nemo_relay.integrations.langgraph.callbacks](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/integrations/langgraph/callbacks.md): LangGraph callback handler that reuses the LangChain NeMo Relay integration. - [nemo_relay.intercepts](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/intercepts.md): Global middleware intercept registration for tools and LLMs. - [nemo_relay.llm](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/llm.md): LLM lifecycle helpers for non-streaming and streaming calls. - [nemo_relay.model_pricing](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/model-pricing.md): Model pricing plugin configuration helpers. - [nemo_relay.observability](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/observability.md): Observability plugin configuration helpers. - [nemo_relay.pii_redaction](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/pii-redaction.md): PII redaction plugin configuration helpers. - [nemo_relay.plugin](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/plugin.md): Generic plugin configuration and registration helpers. - [nemo_relay.runtime_registrations](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/runtime-registrations.md): Dynamic eligibility controls for global runtime registrations. - [nemo_relay.scope](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/scope.md): Scope stack operations. - [nemo_relay.scope_local](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/scope-local.md): Scope-local middleware and subscriber registration. - [nemo_relay.subscribers](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/subscribers.md): Global event subscriber registration. - [nemo_relay.tools](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/tools.md): Tool lifecycle helpers. - [nemo_relay.typed](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/typed.md): Typed wrappers around the JSON-based NeMo Relay execution APIs. - [nemo_relay.utils](https://docs.nvidia.com/nemo/relay/v0.8.4/reference/api/python-library-reference/nemo-relay/utils.md):