
Skill
nemo-relay-instrument-typed-wrappers
instrument NeMo Relay typed wrappers
Description
Use this skill when adding NeMo Relay typed wrappers, domain types, or provider codecs while preserving JSON middleware semantics and caller-visible behavior.
SKILL.md
Use Typed Wrappers And Codecs
Use this skill when an application wants stronger domain types than raw JSON for tool or LLM integration. Keep typed boundaries explicit so middleware still sees predictable JSON.
Default Guidance
- Prefer plain JSON first for initial adoption.
- Reach for typed wrappers when the application already has stable domain models.
- Keep in mind that middleware still operates on JSON, not typed objects.
Embedded Codec Model
- A typed value codec is a pure boundary translator. It converts application-facing values to JSON before NeMo Relay emits events or runs middleware, then converts JSON back into the framework callback or caller type.
- Python exposes
JsonPassthrough,DataclassCodec,PydanticCodec, andBestEffortAnyCodec. Node.js exposesJsonPassthroughplus customCodec<T>implementations. - Use
BestEffortAnyCodeconly at boundaries where strict schemas are not available. Prefer dataclass, Pydantic, or explicit Node.js codecs when the framework owns a stable schema. - Provider codecs are different from typed value codecs: they normalize provider-specific LLM requests and responses so middleware and subscribers can inspect messages, tools, model names, generation parameters, and response annotations.
- Built-in provider codecs include
OpenAIChatCodec,OpenAIResponsesCodec, andAnthropicMessagesCodecin Python, Node.js, and Rust. Choose the codec that matches the actual provider payload shape. - Response codecs annotate LLM end events with fields such as
id,model,message,tool_calls,finish_reason,usage, provider-specific data, and extra unmodeled fields. They do not rewrite the caller-visible response. - Request codecs run before LLM request intercepts. Intercepts receive both the
raw
LLMRequestand optional annotated request;encodemerges annotated edits back before execution intercepts and the provider callback run.
Key Rules
- Typed wrappers are currently a first-class path for Python and Node.js; Rust uses codec traits directly
- Request/response conversion belongs in codecs
- Intercepts and guardrails see JSON values after encoding
- Changes made by middleware survive into the decode step
Choose A Codec
JsonPassthroughfor JSON-native valuesDataclassCodecorPydanticCodecin Python when the models already exist- Custom codecs for domain-specific wire shapes
BestEffortAnyCodeconly when broad flexibility is worth the looser contract- Provider codecs for LLM provider payloads, not application domain objects conversion
Validation Checklist
- Codec output is JSON-compatible
- Required fields survive
toJson/fromJsonordecode/encode - Middleware sees the expected serialized shape
- Provider codecs preserve fields they do not understand
- Response codec failures do not break the underlying LLM call
- Request codec
encodepreserves original provider fields unless an intercept intentionally changes them
Related Skills
nemo-relay-instrument-callsnemo-relay-plugin-observabilitynemo-relay-debug-runtime-integration
More skills from the NeMo-Relay repository
View all 10 skillsnemo-relay-debug-runtime-integration
debug NeMo Relay runtime integrations
Jul 17DebuggingEngineeringMiddlewareNVIDIAnemo-relay-get-started
get started with NeMo Relay
Jul 17CLINVIDIAOnboardingPythonnemo-relay-install
install NeMo Relay for various environments
Jul 17CLIDeploymentNode.jsNVIDIA +2nemo-relay-instrument-calls
instrument LLM calls with NeMo Relay
Jul 17AutomationLLMMiddlewareNVIDIAnemo-relay-instrument-context-isolation
isolate NeMo Relay execution contexts
Jul 17ConcurrencyEngineeringMiddlewareNVIDIAnemo-relay-migrate-from-flow
migrate applications from NeMo Flow to Relay
Jul 17GoMigrationNode.jsNVIDIA +2
More from NVIDIA
View publishernemoclaw-user-guide
retrieve NemoClaw documentation and configuration
NemoClaw
Jul 20DocumentationMCPSearchmcore-build-and-dependency
manage Megatron-LM development environments
Megatron-LM
Jul 14ContainersDeploymentPythonmcore-bump-base-image
update NVIDIA PyTorch base images
Megatron-LM
Jul 14CI/CDDeploymentmcore-cicd
manage CI/CD pipelines for Megatron-LM
Megatron-LM
Jul 14CI/CDDeploymentGitHubmcore-create-issue
investigate CI failures and create issues
Megatron-LM
Jul 14DebuggingGitHubTriagemcore-linting-and-formatting
lint and format Megatron-LM code
Megatron-LM
Jul 14Best PracticesCode Analysis