nemo-relay-instrument-context-isolation

Configure isolated NeMo Relay scope stacks for concurrent requests, agents, and workers.

3.2k|370|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/NVIDIA/skills --skill nemo-relay-instrument-context-isolation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nemo-relay-instrument-context-isolation
Source: https://github.com/NVIDIA/skills/tree/main/skills/nemo-relay-instrument-context-isolation
Command: npx skills add https://github.com/NVIDIA/skills --skill nemo-relay-instrument-context-isolation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Concurrent applications using NeMo Relay instrumentation often suffer from observability cross-contamination: events from different requests appear under one root UUID, scope-local middleware leaks across requests, and worker threads run without the expected active scope. This Skill teaches agents how to give each independent request, agent, or workflow its own scope stack with correct ancestry propagation.

Core Features & Use Cases

  • Per-Language Isolation Patterns: Python task-local stacks via get_scope_stack() and contextvars, Rust helpers like create_scope_stack() and set_thread_scope_stack(...), Go NewScopeStack() with ScopeStack.Run(...), and Node.js createScopeStack() with setThreadScopeStack(...).
  • Scope Model Guidance: Explains the root scope, parent-child scope trees, standard scope types (Agent, Function, Tool, Llm, Retriever, and more), and scope-local registration lifetimes.
  • Failure Diagnosis: Identifies common failures such as shared mutable stacks across goroutines, middleware leaking between agents, and lost stacks across async or worker boundaries.
  • Use Case: A Node.js multi-agent orchestrator where five agents run in one process and tool-call events bleed into other agents' traces gets fixed by assigning each agent its own scope stack.

Quick Start

Ask your agent to set up isolated NeMo Relay scope stacks for your concurrent Python, Go, Rust, or Node.js application so each request or agent gets independent ancestry.

Frequently Asked Questions about nemo-relay-instrument-context-isolation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I isolate NeMo Relay scope stacks for concurrent requests?

Give each independent request, agent, or workflow its own scope stack instead of sharing one mutable stack. In Python, rely on task-local behavior via get_scope_stack() and contextvars; in Go, use NewScopeStack() with ScopeStack.Run(...) for goroutine-safe isolation.

Why do events from different requests appear under one root UUID?

This happens when unrelated concurrent work shares a single mutable scope stack, so all events inherit the same ancestry. Create a separate scope stack per request or worker so the parent-child scope tree reflects each request boundary.

How do I propagate NeMo Relay scopes across goroutines in Go?

Use NewScopeStack() to create a stack and ScopeStack.Run(...) to execute work within it, which provides goroutine-safe usage. Do not rely on a thread-local stack after crossing goroutine boundaries.

Does NeMo Relay context isolation work in Node.js multi-agent systems?

Yes. Create and set a scope stack explicitly for each agent's execution path using createScopeStack() and setThreadScopeStack(...). Scope-local registrations then disappear when the owning scope closes, preventing middleware from leaking between agents.

When should I not share a scope stack across async tasks?

Avoid sharing whenever tasks represent unrelated requests or agents, because shared stacks cause shared ancestry and shared scope-local middleware. Only share when you intentionally want common parentage across the work.