nemo-relay-use-context-isolation

por nvidia

Set up and reason about NeMo Relay scope-stack isolation for concurrent application work

npx skills add https://github.com/nvidia/nemo-relay --skill nemo-relay-use-context-isolation

Use Context Isolation

Use this skill when an application runs concurrent requests, worker pools, async tasks, goroutines, or multiple agents in the same process.

Core Rule

Each independent request, agent, or workflow needs its own scope stack. Do not share one mutable stack across unrelated concurrent work unless you want shared ancestry and shared scope-local middleware.

Embedded Scope Model

  • A root scope is always present, and pushed scopes form a parent-child tree beneath it.
  • Scope hierarchy determines event parentage, lifetime boundaries, and visibility for scope-local middleware and subscribers.
  • Standard scope types include Agent, Function, Tool, Llm, Retriever, Embedder, Reranker, Guardrail, Evaluator, Custom, and Unknown.
  • Scope start and end events can carry semantic input and output payloads when the scope represents a request, task, or meaningful result boundary.
  • Scope-local registrations disappear when the owning scope closes; use them for behavior that should not outlive a request or agent run.
  • Mark events are useful for retries, checkpoints, interrupts, and important state transitions that are not full spans.

Per-Language Defaults

  • Python: rely on task-local behavior via get_scope_stack() and contextvars, or explicitly propagate when work leaves the current execution context
  • Rust core: use runtime helpers such as create_scope_stack(), current_scope_stack(), and set_thread_scope_stack(...) when an integration needs explicit stack ownership
  • Go: use NewScopeStack() and ScopeStack.Run(...) for goroutine-safe usage
  • Node.js: create and set a scope stack explicitly for the current execution path with createScopeStack() and setThreadScopeStack(...)

Common Failures

  • Events from different requests appear under one root UUID
  • Scope-local middleware leaks across requests
  • Worker-thread work runs without the expected active scope
  • Integrations activate NeMo Relay without an explicitly initialized stack
  • Relying on a thread-local stack after crossing async tasks, goroutines, or JS worker boundaries

Related Skills

  • nemo-relay-instrument-calls
  • nemo-relay-setup-observability
  • nemo-relay-debug-runtime-integration

Más skills de nvidia

compileiq-debug
nvidia
Úsalo cuando algo esté mal: Search() se cuelga, todas las evaluaciones devuelven INVALID_SCORE, las puntuaciones no mejoran, cada configuración devuelve el mismo número, errores de ptxas…
official
create-github-pr
nvidia
Crear solicitudes de extracción de GitHub usando la CLI gh. Usar cuando el usuario quiera crear un nuevo PR, enviar código para revisión o abrir una solicitud de extracción. Palabras clave de activación -…
official
diagnose-perf
nvidia
First-responder performance triage for Isaac Sim and Isaac Lab. Identifies bottleneck category (GPU-bound, CPU-bound, VRAM, loading) using nvidia-smi and…
official
eagle3-review-logs
nvidia
Revisa los registros de experimentos del pipeline EAGLE3 desde el directorio experiments/ del lanzador. Resume el estado de aprobación/fallo para las 4 tareas, diagnostica fallos con la causa raíz…
official
nemoclaw-maintainer-cross-issue-sweep
nvidia
Scans other open issues to find ones a given PR may also fix or accidentally break. Outputs adjacent-fix opportunities and contradiction risks with file:line…
official
karpathy-guidelines
nvidia
Pautas de comportamiento para reducir errores comunes de codificación en LLM. Úselas al escribir, revisar o refactorizar código para evitar la sobrecomplicación, realizar cambios quirúrgicos,…
official
fhir-basics
nvidia
Enseña a los agentes cómo funcionan las APIs de FHIR R4, qué recursos están disponibles, cómo consultarlos con parámetros de búsqueda y cómo analizar correctamente todos los formatos de respuesta…
official
underdeclared-agent
nvidia
A helpful assistant agent
official