Skip to content

The agent that grows with you

docs: document nemo_relay session-span segmentation config

Teknium151e8af932e1
diff --git a/plugins/observability/nemo_relay/README.md b/plugins/observability/nemo_relay/README.md
index 85f7d039031..2eef2719205 100644
--- a/plugins/observability/nemo_relay/README.md
+++ b/plugins/observability/nemo_relay/README.md
@@ -93,6 +93,29 @@ The plugin remains opt-in even though the runtime dependency is installed by
default. Enabling this plugin controls rich observability and adaptive
behavior; it does not control Hermes shared client metrics.
+## Session-Span Segmentation (Continuous Sessions)
+
+Relay export is close-driven: a span exports when its scope pops. Continuous
+gateway sessions keep the session scope open indefinitely, so the session root
+span and session-level marks stay unexported until `/new` or idle-end, and a
+crash loses the open segment. Opt-in segmentation rotates the session scope at
+turn boundaries via `config.yaml`:
+
+```yaml
+gateway:
+ telemetry:
+ session_segments:
+ on_compaction: false # rotate when the session compacts
+ max_turns: 0 # 0 = unlimited; N = rotate after N turns
+```
+
+Both defaults are off (no rotation — identical to previous behavior). Rotated
+segments share the `session_id` attribute and carry
+`hermes.session.segment` / `hermes.session.segment_reason`
+(`compaction` | `max_turns`) metadata. Rotation only happens at turn
+boundaries, never mid-turn. See the built-in plugins page on the docs site for
+the full behavior table.
+
## Export Configuration
The plugin can configure exporters directly from `HERMES_NEMO_RELAY_*`
diff --git a/website/docs/user-guide/features/built-in-plugins.md b/website/docs/user-guide/features/built-in-plugins.md
index 9ffbf639f70..77edbf71163 100644
--- a/website/docs/user-guide/features/built-in-plugins.md
+++ b/website/docs/user-guide/features/built-in-plugins.md
@@ -203,6 +203,41 @@ Hermes-prefixed and standard SDK env vars (`LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECR
**Disabling:** `hermes plugins disable observability/langfuse`. The plugin module is still discovered, but no module code runs until you re-enable.
+### observability/nemo_relay
+
+Relays Hermes execution boundaries — sessions, turns, LLM calls, and tool invocations — to an [NVIDIA NeMo Relay](https://docs.nvidia.com/nemo/relay/about-nemo-relay/overview) endpoint. Hermes core owns the Relay session/turn/LLM/tool scopes; the plugin configures exporters (ATOF JSONL, ATIF trajectories, OpenTelemetry) and adds observer marks for approvals and delegated subagents. Full exporter setup lives in the plugin's `README.md` under `plugins/observability/nemo_relay/`.
+
+**Enabling:**
+
+```bash
+hermes plugins enable observability/nemo_relay
+```
+
+#### Session-span segmentation (continuous sessions)
+
+Relay export is close-driven: a span exports when its scope pops. A continuous gateway session (the normal state for a Telegram/Slack agent) keeps its session scope open for days or weeks, so the session root span — and any marks attached to it — stays unexported until `/new` or idle-end, and a crash or redeploy loses the whole open segment. Turn spans are unaffected; they already export per-turn.
+
+Opt-in segmentation rotates the session scope at turn boundaries, in `config.yaml`:
+
+```yaml
+gateway:
+ telemetry:
+ session_segments:
+ on_compaction: false # rotate the session scope when the session compacts
+ max_turns: 0 # 0 = unlimited; N = rotate after N turns per segment
+```
+
+| Key | Default | Behaviour |
+|---|---|---|
+| `on_compaction` | `false` | Close and reopen the session scope after a context compaction completes (at the next turn boundary, never mid-turn) |
+| `max_turns` | `0` | Rotate after every N turns within a segment; `0` disables the cap |
+
+Both defaults are off — with no config set, the scope lifecycle is identical to previous releases (one session scope for the life of the session).
+
+Rotated segments keep the same `session_id` attribute and add `hermes.session.segment` (0-based index) plus `hermes.session.segment_reason` (`compaction` or `max_turns`), so dashboards that group on `session_id` are unaffected. Rotation happens exclusively at turn boundaries and rides the same bounded scope-op executor as every other native Relay call — a wedged exporter costs one segment span, never the agent.
+
+**Disabling:** remove the `session_segments` block (or set both keys back to their defaults).
+
### google_meet
Lets the agent **join, transcribe, and participate in Google Meet calls** — take notes on a meeting, summarize the back-and-forth after, follow up on specific points, and (optionally) speak replies back into the call via TTS.