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.
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.
npx agentmods add skills/sgl-project/sglang/add-sgl-kernelnpx skills add sgl-project/sglang --skill add-sgl-kernelgit clone --depth 1 https://github.com/sgl-project/sglangWrote 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.
[](https://agentmods.dev/skills/sgl-project/sglang/add-sgl-kernel)<a href="https://agentmods.dev/skills/sgl-project/sglang/add-sgl-kernel"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/add-sgl-kernel.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00031 | $0.03388 |
| Opus 5 | $0.00015 | $0.01694 |
| Sonnet 5 | $0.00006 | $0.00678 |
| Haiku 4.5 | $0.00003 | $0.00339 |
Grade A, and why
add-sgl-kernel 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.
How it starts
The opening of the file, as written. The whole thing — 368 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Tutorial: Adding a New Kernel to sgl-kernel (AOT / Heavyweight)
This tutorial walks through adding a simple element-wise scale operation as an AOT kernel. We'll implement scale(x, factor) = x * factor to demonstrate the complete workflow.
Goal
Add a new operation that scales each element of a tensor by a scalar factor:
- Input: tensor
x(CUDA) and scalarfactor(float) - Output:
x * factor(element-wise, in-place or into pre-allocatedout) - Supported dtypes: FP16 (
torch.float16), BF16 (torch.bfloat16), FP32 (torch.float32)- Dispatched via
DISPATCH_PYTORCH_DTYPE_TO_CTYPE_FLOAT_FP16macro (defined inpython/sglang/kernels/aot/include/utils.h)
- Dispatched via
Two rules of thumb (must follow)
- Prefer
python/sglang/kernels/jitfirst when the kernel does not depend on CUTLASS or another large C++ project. This is the default path for lightweight kernels that benefit from rapid iteration. - Prefer
sgl-kernelwhen the kernel does depend on CUTLASS or another large C++ project, or when it should be part of the AOT wheel / torch op registration flow. - Exception: if the dependency is
flashinfer, or CUTLASS that is already provided throughflashinfer, the kernel can still be implemented asjit_kernel.
In addition, every new kernel must ship with:
- Tests (pytest)
- A benchmark script (triton.testing)
Repository integration map
You will typically touch these files/areas:
- Implementation:
python/sglang/kernels/aot/csrc/elementwise/scale.cu(pick the right subdirectory) - Public declarations:
python/sglang/kernels/aot/include/sgl_kernel_ops.h - Torch extension registration:
python/sglang/kernels/aot/csrc/common_extension.cc - Build:
python/sglang/kernels/aot/CMakeLists.txt(set(SOURCES ...)) - Python API:
python/sglang/kernels/aot/python/sgl_kernel/andpython/sglang/kernels/aot/python/sgl_kernel/__init__.py - Tests:
python/sglang/kernels/aot/tests/test_scale.py - Benchmarks:
python/sglang/kernels/aot/benchmark/bench_scale.py
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.
- 6d ago First seen · 368 lines · 31 tokens per session scan A 1560d3d9f4c9
add-sgl-kernel is a skill published in the GitHub repository sgl-project/sglang (35,483 stars, last pushed today), licensed Apache-2.0. It adds 31 tokens to every session and 3,388 once invoked, about $0.0002 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.
Other skills, from other repositories
add-cuda-kernel
Rules and steps for creating a compute kernel in RL.cu project.
cpp-coding-standards
C++ coding standards based on the C++ Core Guidelines (isocpp.github.io). Use when writing, reviewing, or refactoring C++ code to enforce modern, safe, and idiomatic practices.
add-cuda-kernel
Step-by-step tutorial for adding new CUDA kernels to FlashInfer.
cuopt-developer
Modify, build, test, debug, and contribute to NVIDIA cuOpt (C++/CUDA, Python, server, CI). Use for solver internals, PRs, DCO, and code conventions.
transform-model
Use when onboarding a Hugging Face model into TensorRT-Model-Connect or extending an existing family to produce a .bundle bundle. Drives ownership-first implementation across Python builder, native runtime, and model-owned E2E descriptors, then requires reference-consistency and runtime evidence before support is…
readable-cpp
Readable C/C++/Rust/CUDA code rules inspired by The Art of Readable Code. Use when writing, reviewing, or refactoring C, C++, Rust, or CUDA code. Enforces short functions, flat control flow, clear naming, readable structure, and idiomatic patterns.