> 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.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server. # Module context_helpers > Context helpers for reading scope metadata on the intercept hot path. Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker`. Context helpers for reading scope metadata on the intercept hot path. These functions read from the NeMo Relay scope stack (via [`current_scope_stack`](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-current-scope-stack)) to extract information needed by the LLM request intercept: * [`extract_scope_path`](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-extract-scope-path): collects function names from the scope stack for trie lookup * [`read_manual_latency_sensitivity`](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-read-manual-latency-sensitivity): walks all scopes for manual `latency_sensitive` annotations * [`resolve_agent_id`](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-resolve-agent-id): returns the first Agent scope name from the scope stack All functions are safe to call from sync contexts (intercepts are sync closures). They acquire a read lock on the scope stack, which is always fast. ## Metadata Convention Manual latency sensitivity is stored in scope metadata under the JSON path `/nemo_relay_adaptive/latency_sensitivity` as a positive integer. ## Structs * [SharedParentScopeIdentity](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/struct-sharedparentscopeidentity): Session-local scope identity used to coordinate warm-first cohorts. ## Constants * [LATENCY\_SENSITIVITY\_POINTER](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/constant-latency-sensitivity-pointer): Metadata key path for manual latency sensitivity annotation. ## Functions * [extract\_scope\_path](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-extract-scope-path): Extracts the current function call path from the NeMo Relay scope stack. * [read\_manual\_latency\_sensitivity](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-read-manual-latency-sensitivity): Reads the maximum manual latency sensitivity from all scopes in the current scope stack. * [resolve\_agent\_id](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-resolve-agent-id): Resolves the agent ID from the current scope stack. * [resolve\_shared\_parent\_scope\_identity](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-resolve-shared-parent-scope-identity): Resolves the session-local identity used by warm-first cohort coordination. * [set\_latency\_sensitivity](/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-set-latency-sensitivity): Sets latency sensitivity on the current (top) scope using max-merge semantics. > Context helpers for reading scope metadata on the intercept hot path. ## Docs - [Struct Shared Parent Scope Identity](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/struct-sharedparentscopeidentity.md): Session-local scope identity used to coordinate warm-first cohorts. - [Constant LATENCY_SENSITIVITY_POINTER](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/constant-latency-sensitivity-pointer.md): Metadata key path for manual latency sensitivity annotation. - [Function extract_scope_path](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-extract-scope-path.md): Extracts the current function call path from the NeMo Relay scope stack. - [Function read_manual_latency_sensitivity](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-read-manual-latency-sensitivity.md): Reads the maximum manual latency sensitivity from all scopes in the current scope stack. - [Function resolve_agent_id](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-resolve-agent-id.md): Resolves the agent ID from the current scope stack. - [Function resolve_shared_parent_scope_identity](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-resolve-shared-parent-scope-identity.md): Resolves the session-local identity used by warm-first cohort coordination. - [Function set_latency_sensitivity](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-adaptive/context_helpers/fn-set-latency-sensitivity.md): Sets latency sensitivity on the current (top) scope using max-merge semantics.