> ## Documentation Index
> Fetch the complete documentation index at: https://agent-observability-docs.splunk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# session_context

## Module

Execution-context-local session selection and W3C baggage propagation.

## \_SessionSelection

Marker type for execution-local session selection state.

## SplunkAOSessionPropagator

Preserve the configured propagator while normalizing session baggage.

## clear\_session\_context

```python theme={null}
def clear_session_context() -> None
```

Explicitly suppress local, inbound, and compatibility session selection.

## explicit\_session\_id

```python theme={null}
def explicit_session_id(selection: SessionSelection) -> tuple[bool, str | None]
```

Return whether a saved selection is explicit and its session value.

## extract\_session\_context

```python theme={null}
def extract_session_context(carrier: Any,
                            context: Context | None=None,
                            getter: textmap.Getter[Any]=textmap.default_getter) -> Context
```

Extract configured trace context and normalize session baggage.

## get\_effective\_session\_id

```python theme={null}
def get_effective_session_id(logger_session_id: str | None=None,
                             context: Context | None=None) -> str | None
```

Resolve the execution-local, inbound, or compatibility session ID.

## get\_session\_selection

```python theme={null}
def get_session_selection() -> SessionSelection
```

Return the raw execution-local selection for nested-context restoration.

## inject\_session\_context

```python theme={null}
def inject_session_context(carrier: Any,
                           context: Context | None=None,
                           setter: textmap.Setter[Any]=textmap.default_setter) -> None
```

Inject configured trace context and normalized session baggage.

## install\_session\_propagator

```python theme={null}
def install_session_propagator() -> None
```

Wrap the process-global propagator with the session-aware adapter.

The current propagator remains the delegate. Replacing the global
propagator later also removes this adapter until this function is called
again.

## restore\_session\_selection

```python theme={null}
def restore_session_selection(selection: SessionSelection) -> None
```

Restore a previously captured execution-local selection.

## set\_session\_context

```python theme={null}
def set_session_context(session_id: str | None) -> None
```

Set or reset the explicit session selection for this execution context.

Passing `None` retains the historical reset behavior: inbound baggage and
the logger compatibility field may be consulted again. Use
