Skip to content

Commit d245a5b

Browse files
authored
docs(sglang): correct session radix availability (ai-dynamo#11241)
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
1 parent 91376af commit d245a5b

11 files changed

Lines changed: 18 additions & 45 deletions

File tree

components/src/dynamo/sglang/CLAUDE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,11 @@ text-to-video-diffusion.sh # 1-2 GPUs - Text-to-video (Wan2.1)
313313
Always slice with an offset, don't assume per-chunk logprobs.
314314
- **Zombie GPU processes**: `sgl_diffusion::scheduler` spawns a child process that
315315
survives parent kill. Always check `nvidia-smi` after teardown.
316-
- **Session radix cache**: SGLang 0.5.14+ provides session-aware radix ownership
317-
without an opt-in flag. The handler passes `agent_context.session_id` to SGLang
318-
as `session_params.id`. Agent KV hints are forwarded as metadata but are not
319-
acted on by the SGLang backend. This path does not create router affinity.
316+
- **Session identity**: SGLang 0.5.14 does not support passive session-aware radix
317+
ownership. Do not pass `agent_context.session_id` as `session_params.id`;
318+
SGLang treats that field as an explicit session lifecycle and rejects IDs that
319+
were not created through `open_session`. Session headers remain available for
320+
tracing and router affinity.
320321

321322
For troubleshooting (CuDNN, config.json errors, OOM, disagg connectivity), see
322323
`docs/backends/sglang/sglang-examples.md#troubleshooting`.

components/src/dynamo/sglang/request_handlers/handler_base.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,6 @@ def __init__(
669669
self.serving_mode = config.serving_mode
670670
self.use_sglang_tokenizer = config.dynamo_args.use_sglang_tokenizer
671671
self.enable_trace = getattr(config.server_args, "enable_trace", False)
672-
self.enable_session_radix_cache = getattr(
673-
config.server_args, "enable_session_radix_cache", False
674-
)
675672

676673
if engine is not None:
677674
self.input_param_manager = InputParamManager(
@@ -1019,16 +1016,6 @@ def _get_input_param(self, request: Dict[str, Any]) -> Dict[str, Any]:
10191016
"prompt" if isinstance(request_input, str) else "input_ids": request_input
10201017
}
10211018

1022-
def _session_id(self, request: Dict[str, Any]) -> Optional[str]:
1023-
if not self.enable_session_radix_cache:
1024-
return None
1025-
session_id = (request.get("agent_context") or {}).get("session_id")
1026-
return session_id if isinstance(session_id, str) and session_id else None
1027-
1028-
def _session_kwargs(self, request: Dict[str, Any]) -> Dict[str, Any]:
1029-
session_id = self._session_id(request)
1030-
return {"session_params": {"id": session_id}} if session_id else {}
1031-
10321019
@staticmethod
10331020
def _get_guided_decoding_params(
10341021
guided_decoding: Optional[Dict[str, Any]],

components/src/dynamo/sglang/request_handlers/llm/decode_handler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ async def generate(
395395
external_trace_header=trace_header,
396396
rid=trace_id,
397397
data_parallel_rank=dp_rank,
398-
**self._session_kwargs(request),
399398
lora_path=lora_path,
400399
**logprob_kwargs,
401400
**self._priority_kwargs(priority),
@@ -463,7 +462,6 @@ async def generate(
463462
external_trace_header=trace_header,
464463
rid=trace_id,
465464
data_parallel_rank=dp_rank,
466-
**self._session_kwargs(request),
467465
lora_path=lora_path,
468466
**logprob_kwargs,
469467
**self._priority_kwargs(priority),

components/src/dynamo/sglang/request_handlers/llm/prefill_handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ async def generate(
166166
external_trace_header=trace_header,
167167
rid=trace_id,
168168
data_parallel_rank=dp_rank,
169-
**self._session_kwargs(inner_request),
170169
lora_path=lora_path,
171170
**self._priority_kwargs(priority),
172171
)

components/src/dynamo/sglang/tests/test_sglang_frontend_decoding.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ async def no_cancellation_monitor(*args, **kwargs):
9797

9898
handler._get_input_param = lambda req: {"input_ids": req.get("token_ids", [])}
9999
handler._resolve_lora = lambda req: None
100-
handler._session_kwargs = lambda req: {}
101100
handler._priority_kwargs = lambda priority: {}
102101

103102
return handler

docs/backends/sglang/agents.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44
title: SGLang for Agentic Workloads
5-
subtitle: Priority scheduling and session-aware radix KV for agentic serving
5+
subtitle: Priority scheduling and KV cache tuning for agentic serving
66
---
77

8-
This guide covers SGLang-specific configuration for agentic serving with Dynamo. It explains which SGLang engine flags to enable, how Dynamo's [agent hints](../../components/frontend/nvext.md#agent-hints) map to SGLang behavior, and how to tag radix KV by session.
8+
This guide covers SGLang-specific configuration for agentic serving with Dynamo. It explains which SGLang engine flags to enable, how Dynamo's [agent hints](../../components/frontend/nvext.md#agent-hints) map to SGLang behavior, and how session headers interact with SGLang 0.5.14.
99

1010
## Overview
1111

@@ -111,23 +111,14 @@ for chunk in response:
111111
print(chunk.choices[0].delta.content, end="")
112112
```
113113

114-
## Session Radix Cache
114+
## Session Identity
115115

116-
SGLang can tag ordinary evictable radix KV with the normalized agent session ID without pinning requests to a worker or creating a separate streaming-session lifecycle.
116+
Dynamo normalizes agent headers such as `X-Dynamo-Session-ID` for request tracing and router affinity. SGLang 0.5.14 does not support passive session-aware radix ownership, so the Dynamo worker does not attach this ID to SGLang generate requests.
117117

118-
> **Availability:** Session-aware radix ownership is built into SGLang 0.5.14 and later; no opt-in server argument is required.
118+
> [!NOTE]
119+
> SGLang 0.5.14's `session_params` belongs to its explicit session lifecycle and requires a session created through `open_session`. It is not a passive KV ownership tag.
119120
120-
Launch the worker with:
121-
122-
```bash
123-
python -m dynamo.sglang \
124-
--model-path <model> \
125-
--radix-eviction-policy priority
126-
```
127-
128-
Dynamo reads session identity from agent headers such as `X-Dynamo-Session-ID` and passes it to SGLang on every generate request. `X-Dynamo-Session-Final: true` is normalized into an internal KV eviction hint and forwarded with the agent context, but the SGLang backend does not act on that hint in this release.
129-
130-
The radix entries remain normally evictable. Session-aware radix ownership does not create router affinity; a configured router can independently use `X-Dynamo-Session-ID` for router-local affinity.
121+
The `--radix-eviction-policy priority` flag controls priority-based KV eviction only; it does not tag radix entries by session. `X-Dynamo-Session-Final: true` is normalized into an internal KV eviction hint, but the SGLang backend does not act on that hint in this release.
131122

132123
## Quickstart
133124

@@ -138,7 +129,7 @@ bash examples/backends/sglang/launch/agg_agent.sh \
138129
--model-path zai-org/GLM-4.7-Flash --tp 2
139130
```
140131

141-
Agent providers send session headers directly; no body-level lifecycle object is needed.
132+
Agent providers send session headers directly for tracing and router affinity; no body-level lifecycle object is needed.
142133

143134
## See Also
144135

docs/backends/sglang/sglang-chat-processor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,4 @@ Key differences:
151151

152152
- **[Tool Calling](../../tool-calling/README.md)**: General tool calling guide
153153
- **[Reference Guide](sglang-reference-guide.md)**: Full SGLang backend reference
154-
- **[Agentic Workloads](agents.md)**: Priority scheduling and session-aware radix KV
154+
- **[Agentic Workloads](agents.md)**: Priority scheduling and KV cache tuning

docs/components/frontend/nvext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,4 @@ When the client requests response metadata via `extra_fields`, the response incl
229229
| [Session IDs](../../agents/session-ids.md) | Passive session identity |
230230
| [Agent Tracing](../../agents/agent-tracing.md) | JSONL request traces, inferred tool-call metadata, and harness tool-event ingestion |
231231
| [Agent Hints](../../agents/agent-hints.md) | Per-request serving hints for routing, scheduling, and cache behavior |
232-
| [SGLang for Agentic Workloads](../../backends/sglang/agents.md) | SGLang engine flags for priority scheduling, eviction policies, and session-aware radix tagging |
232+
| [SGLang for Agentic Workloads](../../backends/sglang/agents.md) | SGLang engine flags for priority scheduling and KV eviction policies |

docs/digest/agentic-inference/agentic-inference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Making blocks globally available solves the sharing problem, but does not solve
170170

171171
The general design pattern is to attach zero or more retention directives to a request or token range. Blocks without directives follow the default LRU path with zero overhead. The evictor becomes a two-structure system: an LRU free list for unprioritized blocks (O(1), unchanged) and a priority queue for annotated blocks. Dynamo's public agent surface exposes the priority part today through `nvext.agent_hints.priority`; TTL or per-token-range retention directives are future API work.
172172

173-
Anthropic's prompt caching lets you mark prefixes as cacheable on their infrastructure. Dynamo does not currently expose the same semantics as a self-hosted `nvext.cache_control` TTL pinning API. The supported production path is priority-driven: `nvext.agent_hints.priority` can influence router queueing and, when the backend enables it, engine scheduling and priority-aware cache eviction. SGLang can additionally tag ordinary evictable radix KV by session.
173+
Anthropic's prompt caching lets you mark prefixes as cacheable on their infrastructure. Dynamo does not currently expose the same semantics as a self-hosted `nvext.cache_control` TTL pinning API. The supported production path is priority-driven: `nvext.agent_hints.priority` can influence router queueing and, when the backend enables it, engine scheduling and priority-aware cache eviction.
174174

175175
The next step is connecting richer retention directives with the distributed cache. Today, priority and session metadata are local serving signals, not a cluster-wide per-block TTL lease. Extending retention semantics across HiCache/KVBM's shared storage tier would let the harness mark a block once and have its priority, lifetime, and placement intent travel with it through the write-through path. Combined with the prefetch hooks described above, this gives the harness end-to-end lifecycle control across the full memory hierarchy.
176176

examples/backends/sglang/launch/_test_agg.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
# Same shape as agg_router.sh (2 workers, KV routing, KV events) but with:
1010
# - --enable-hierarchical-cache -> HiCache row populates
11-
# - session-aware radix ownership -> session-tagged radix KV
1211
# - --enable-metrics-for-all-schedulers -> per-scheduler metrics
1312
# - --enable-mfu-metrics -> model FLOPs utilization
1413
# - --mem-fraction-static 0.92 -> larger KV pool per worker
@@ -104,7 +103,6 @@ Topology:
104103
105104
Features enabled for full Grafana coverage:
106105
- hierarchical KV cache (host RAM tier) -> HiCache row
107-
- session radix cache -> session-tagged evictable KV
108106
- per-scheduler metrics + MFU metrics
109107
- mem-fraction-static=$MEM_FRACTION, max-running-requests=$MAX_RUNNING
110108
- page-size=$PAGE_SIZE, chunked-prefill-size=$CHUNKED_PREFILL

0 commit comments

Comments
 (0)