sglang-runtime-context

sglang-runtime-context is a skill for Claude Code from sgl-project/sglang. It costs 93 tokens per session (10,059 once invoked), scanned A, original, Apache-2.0.

A guide to SGLang's runtime configuration and process-wide state, including how startup settings are published, grouped, and read during execution.

In plain words
What is it for?
Use it when developing or testing code that reads resolved settings, manages runtime resources, or interacts with the scripted runtime's configuration and state.
Why use it?
It helps developers use the intended configuration sources and avoid reading the original startup record or handling shared resources and per-request flags incorrectly.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

About the project

SGLang is a framework for running inference for large language models and multimodal models, meaning it processes inputs to produce model outputs such as text or other media. It is used to serve and accelerate open AI models and related workloads.

sgl-project/sglang · 35,516 stars · on GitHub · sglang.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sgl-project/sglang/sglang-runtime-context
Any agent
npx skills add sgl-project/sglang --skill sglang-runtime-context
Clone the repo
git clone --depth 1 https://github.com/sgl-project/sglang

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sglang-runtime-context

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-runtime-context.svg)](https://agentmods.dev/skills/sgl-project/sglang/sglang-runtime-context)
Your own site
<a href="https://agentmods.dev/skills/sgl-project/sglang/sglang-runtime-context"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/sglang-runtime-context.svg" alt="Measured on agentmods" height="20"></a>
Per session 93 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 10,059 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00093 $0.10059
Opus 5 $0.00046 $0.05029
Sonnet 5 $0.00019 $0.02012
Haiku 4.5 $0.00009 $0.01006

Measured 6d ago against content hash 6c2955b512b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

sglang-runtime-context scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/sglang-runtime-context/SKILL.md · 609 lines

How it starts

The opening of the file, as written. The whole thing — 609 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SGLang runtime-context architecture

One container owns process-static runtime state: sglang.srt.runtime_context.RuntimeContext (a process singleton reached via get_context()). Everything below is a tier on it.

Tier Accessor Holds Lifecycle
raw config seed get_server_args() the published ServerArgs — the startup record, for debugging, dumps and provenance. Business code does not read fields off it: the read ratchet pins that at zero, and "Reading config: the seed is off limits" below says what to read instead, which forms the ratchet sees, and what is outside it by construction (a runtime-computed name; a whole-object hand-off) published at process entry; re-publish is last-publish-wins (the tokenizer publish in the launcher process; sequential engine rebuild in one process, e.g. unit tests) and re-projects the bags; read-only
resolved config get_exec() get_memory() get_schedule() get_model() get_spec() get_serving() get_observability() get_disagg() get_lora() get_mm() get_device() namespace config bags — the single source of truth for resolved config; leaves are real attributes (dynamo-traceable). Each is a module function of no arguments, and a module binds the name once: manager.get_disagg(), self.get_disagg = get_disagg, or a same-named import next to the bag one (from model_loader import get_model) all import fine and fail only when that path runs. ruff --select F811 catches the import collision; RuntimeContext has no bag-named member and no __getattr__, so the member-call shapes are an AttributeError at call time — give it a delegating __getattr__ and they go silent instead projected at publish from the declarations over server_args' raw fields; mutated only via get_context().override
runtime flags get_flags() state that is not a pure function of config: capture (cuda-graph lifecycle), moe (ACTIVE backends, swappable), dp (DP-attention runtime flags) materialized at subsystem init; groups offer override() for tests
resources get_resources(), get_stream(name), get_buffer(name, factory) process-level handles: graph pools, EPLB state, EP dispatcher state, named side streams, workspace buffers lazy; cleared by reset_context()
per-forward get_forward() forward-scoped flags (multi-stream switch, MoE output buffer, attn-TP inputs, extend-in-batch) contextvar-backed; scoped(**kw) restores on exit; new threads see defaults
parallel get_parallel() one spelling per name: ranks and group handles are the live topology (@property, read-through); every other name, sizes included, is a leaf of the parallel config bag ranks/groups: after dist init; leaves: after publish

reset_context() (unit-test teardown) drops the published config and installs fresh flags/resources/forward tiers.

Read the full file on GitHub · 609 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 609 lines · 93 tokens per session scan A 6c2955b512b0

Subscribe to this mod's changes

sglang-runtime-context is a skill published in the GitHub repository sgl-project/sglang (35,516 stars, last pushed today), licensed Apache-2.0. It adds 93 tokens to every session and 10,059 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

perf-host-analysis

Analyze host/CPU overhead in TensorRT-LLM inference from nsys traces. Detect whether host overhead is the bottleneck using GPU idle ratio, host prep exposed ratio, and per-phase evidence. For regressions, isolate forward steps via allreduce/NVTX patterns, compare host operation breakdowns across versions, and identify…

NVIDIA/TensorRT-LLM · 171 tokens

perf-host-optimization

Profiles and optimizes TensorRT-LLM host/CPU overhead using lineprofiler (with nsys support planned). Runs iterative profile-analyze-optimize-validate rounds. Use when GPU utilization is low or optimizing PyExecutor throughput.

NVIDIA/TensorRT-LLM · 52 tokens

llama-factory

Expert guidance for fine-tuning LLMs with LLaMA-Factory - WebUI no-code, 100+ models, 2/3/4/5/6/8-bit QLoRA, multimodal support.

davila7/claude-code-templates · 51 tokens

mooncake-api

Help users work with the Mooncake Python APIs for distributed storage and high-performance data transfer. Use when working with Mooncake Store (distributed KV cache), Transfer Engine (RDMA/TCP transfers), service setup (master, metadata server), PyTorch tensors in the Store, zero-copy/buffer management, batch…

kvcache-ai/Mooncake · 122 tokens

release-notes

Draft concise release notes.

ollama/ollama · 9 tokens

groq-inference

Ultra-fast LLM inference on custom LPU hardware. OpenAI-compatible API at api.groq.com. Lowest latency in the industry (500-1000+ tok/s). Supports chat completions, vision, audio (Whisper STT + TTS), tool calling, JSON mode, and streaming. Free tier available. Inference only — no training.

synthetic-sciences/openscience · 77 tokens