> This page is for NeMo Relay, version v0.10.0.
> For other versions, use one of these documentation indexes:
> - Latest (v0.10.0) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v0.10.0: https://docs.nvidia.com/nemo/relay/v0.10.0/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt
> - v0.7.3: https://docs.nvidia.com/nemo/relay/v0.7.3/llms.txt
> - v0.6.0: https://docs.nvidia.com/nemo/relay/v0.6.0/llms.txt
> - v0.5.0: https://docs.nvidia.com/nemo/relay/v0.5.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/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.scope_local

> Scope-local middleware and subscriber registration.

Generated from `python/nemo_relay/scope_local.py`.

Module `nemo_relay.scope_local`.

Scope-local middleware and subscriber registration.

## Functions

### `register_event_metadata_injector`

```python
def register_event_metadata_injector(scope_handle: ScopeHandle, name: str, priority: int, injector: EventMetadataInjectorCallback) -> None
```

Register an event metadata injector owned by a scope.

### `deregister_event_metadata_injector`

```python
def deregister_event_metadata_injector(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local event metadata injector.

### `register_mark_sanitize`

```python
def register_mark_sanitize(scope_handle: ScopeHandle, name: str, priority: int, guardrail: EventSanitizeGuardrail) -> None
```

Register a mark-event sanitizer owned by a scope.

### `deregister_mark_sanitize`

```python
def deregister_mark_sanitize(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local mark-event sanitizer.

### `register_scope_sanitize_start`

```python
def register_scope_sanitize_start(scope_handle: ScopeHandle, name: str, priority: int, guardrail: EventSanitizeGuardrail) -> None
```

Register a scope-start event sanitizer owned by a scope.

### `deregister_scope_sanitize_start`

```python
def deregister_scope_sanitize_start(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local scope-start sanitizer.

### `register_scope_sanitize_end`

```python
def register_scope_sanitize_end(scope_handle: ScopeHandle, name: str, priority: int, guardrail: EventSanitizeGuardrail) -> None
```

Register a scope-end event sanitizer owned by a scope.

### `deregister_scope_sanitize_end`

```python
def deregister_scope_sanitize_end(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local scope-end sanitizer.

### `register_tool_sanitize_request`

```python
def register_tool_sanitize_request(scope_handle: ScopeHandle, name: str, priority: int, guardrail: ToolSanitizeGuardrail) -> None
```

Register a scope-local tool sanitize-request guardrail.

### `deregister_tool_sanitize_request`

```python
def deregister_tool_sanitize_request(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local tool sanitize-request guardrail.

### `register_tool_sanitize_response`

```python
def register_tool_sanitize_response(scope_handle: ScopeHandle, name: str, priority: int, guardrail: ToolSanitizeGuardrail) -> None
```

Register a scope-local tool sanitize-response guardrail.

### `deregister_tool_sanitize_response`

```python
def deregister_tool_sanitize_response(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local tool sanitize-response guardrail.

### `register_tool_conditional_execution`

```python
def register_tool_conditional_execution(scope_handle: ScopeHandle, name: str, priority: int, guardrail: ToolConditionalExecutionGuardrail) -> None
```

Register a scope-local tool conditional-execution guardrail.

### `deregister_tool_conditional_execution`

```python
def deregister_tool_conditional_execution(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local tool conditional-execution guardrail.

### `register_tool_request`

```python
def register_tool_request(scope_handle: ScopeHandle, name: str, priority: int, break_chain: bool, fn: ToolRequestIntercept) -> None
```

Register a scope-local tool request intercept.

### `deregister_tool_request`

```python
def deregister_tool_request(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local tool request intercept.

### `register_tool_execution`

```python
def register_tool_execution(scope_handle: ScopeHandle, name: str, priority: int, fn: ToolExecutionIntercept) -> None
```

Register scope-local middleware around tool execution.

### `deregister_tool_execution`

```python
def deregister_tool_execution(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local tool execution intercept.

### `register_llm_sanitize_request`

```python
def register_llm_sanitize_request(scope_handle: ScopeHandle, name: str, priority: int, guardrail: LlmSanitizeRequestGuardrail) -> None
```

Register a scope-local LLM sanitize-request guardrail.

### `deregister_llm_sanitize_request`

```python
def deregister_llm_sanitize_request(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local LLM sanitize-request guardrail.

### `register_llm_sanitize_response`

```python
def register_llm_sanitize_response(scope_handle: ScopeHandle, name: str, priority: int, guardrail: LlmSanitizeResponseGuardrail) -> None
```

Register a scope-local LLM sanitize-response guardrail.

### `deregister_llm_sanitize_response`

```python
def deregister_llm_sanitize_response(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local LLM sanitize-response guardrail.

### `register_llm_conditional_execution`

```python
def register_llm_conditional_execution(scope_handle: ScopeHandle, name: str, priority: int, guardrail: LlmConditionalExecutionGuardrail) -> None
```

Register a scope-local LLM conditional-execution guardrail.

### `deregister_llm_conditional_execution`

```python
def deregister_llm_conditional_execution(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local LLM conditional-execution guardrail.

### `register_llm_request`

```python
def register_llm_request(scope_handle: ScopeHandle, name: str, priority: int, break_chain: bool, fn: LlmRequestIntercept) -> None
```

Register a scope-local LLM request intercept.

### `deregister_llm_request`

```python
def deregister_llm_request(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local LLM request intercept.

### `register_llm_execution`

```python
def register_llm_execution(scope_handle: ScopeHandle, name: str, priority: int, fn: LlmExecutionIntercept) -> None
```

Register scope-local middleware around non-streaming LLM execution.

### `deregister_llm_execution`

```python
def deregister_llm_execution(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local LLM execution intercept.

### `register_llm_stream_execution`

```python
def register_llm_stream_execution(scope_handle: ScopeHandle, name: str, priority: int, fn: LlmStreamExecutionIntercept) -> None
```

Register scope-local middleware around streaming LLM execution.

### `deregister_llm_stream_execution`

```python
def deregister_llm_stream_execution(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local streaming LLM execution intercept.

### `register_subscriber`

```python
def register_subscriber(scope_handle: ScopeHandle, name: str, callback: 'Callable[[Event], None]') -> None
```

Register an event subscriber that is active only for `scope_handle`.

### `deregister_subscriber`

```python
def deregister_subscriber(scope_handle: ScopeHandle, name: str) -> bool
```

Remove a scope-local event subscriber.