When you ship an AI agent that makes multiple model calls, a single malformed response can stall the agent mid-task or send back a garbled answer to the user. The failure shows up more as products move from single-turn chatbots to multi-step agents that call tools and hand results from one step to the next.
A naive serving setup, as a single Hugging Face transformers pipeline runs into two separate problems here. First, there is no way to keep a chain of dependent calls parseable step by step, since it was built to answer one prompt at a time. Second, the same setup usually handles one request at a time rather than batching multiple users’ requests together, since it was not built to handle the production traffic with many people hitting it at once. That second problem is what drives up your compute bill. The server recomputes every prompt from scratch, and every moment the GPU sits idle waiting for the next request (instead of processing several at once) is paid-for hardware doing no useful work.
Getting past both the parseability problem and the idle-GPU cost problem means picking a serving framework built for them from the start. Researchers affiliated with Large Model Systems (LMSYS), the group behind Chatbot Arena, introduced SGLang as one answer to that gap. Let’s explore how SGLang works and how to deploy it on DigitalOcean.
Key takeaways:
SGLang is an open-source Large Language Model (LLM) serving framework designed for high-throughput, multi-step, and agentic workloads.
SGLang reuses cached prompt prefixes similar to how DigitalOcean Inference Router deploys the cache-reuse principle at the routing layer, keeping a session pinned to the model that already holds its warm cache—instead of splitting it across a switch.
SGLang is best suited to production workloads with repeated prompt patterns, structured outputs, or multi-step agent workflows.
DigitalOcean makes SGLang deployment easier with a preconfigured Marketplace 1-Click App. GPU Droplets, DigitalOcean Kubernetes (DOKS), and Bare Metal GPUs offer greater flexibility for custom and large-scale deployments.

SGLang is an open-source LLM serving framework introduced by LMSYS Organization researchers—the same group behind Chatbot Arena. It pairs the SGLang Python package for writing multi-step LLM programs with a runtime built for high-throughput inference. SGLang works with almost all open-weight model architectures (such as Llama, DeepSeek, Qwen, and Gemma), but each server instance serves exactly one model at a time. If your workflow requires serving two different models, you run two separate SGLang server processes, each reserving its own dedicated GPU VRAM. A 2024 SGLang paper introduced RadixAttention for KV cache reuse. The research paper reported up to 6.4x higher throughput when using SGLang than prior serving systems, on tasks ranging from agent control to JSON decoding.
If you need an agent to call a model multiple times, parse JSON at each step, and pass results forward, SGLang’s structured generation keeps that chain from breaking on malformed output. The SGLang GitHub repo has 30k+ stars. SGLang serves companies like NVIDIA and xAI. RadixArk, an infrastructure company that later spun out of the SGLang project, runs SGLang in production on DigitalOcean-hosted AMD GPUs.
SGLang key features:
As a serving framework, SGLang combines several techniques into one runtime:
RadixAttention: Reuses KV cache across requests by storing it in a radix tree, so repeated prompt prefixes skip recomputation.
Continuous batching: Adds and removes requests from a running batch on the fly, keeping GPU utilization high under real traffic.
Quantization support: Integrates with models at INT4, INT8, or FP8 precision to cut memory footprint.
Cross-hardware support: Runs the same codebase on NVIDIA and AMD, so teams don’t need to maintain separate forks per vendor.
RadixAttention is the caching mechanism that SGLang uses to avoid recomputing the same prompt text repeatedly. Ying Sheng, RadixArk’s co-founder, is one of the SGLang paper’s authors and helped invent RadixAttention. It stores the KV cache from every request in a radix tree, a data structure indexed by token sequences. When a new request shares a prefix with something already cached, such as the same system prompt or an earlier turn in a conversation, SGLang reuses that cached portion instead of recalculating it. This is what gives SGLang most of its speed gain on workloads with repeated prompt patterns, since it cuts redundant computation instead of adding more hardware.
For a deeper understanding of what’s actually happening inside the radix tree, Standarity, an AI YouTube channel, shares a walkthrough about RadixAttention design:
SGLang runs the same codebase on:
NVIDIA GPUs through Compute Unified Device Architecture (CUDA)
AMD GPUs through ROCm
Heterogeneous-computing Interface for Portability (HIP)
Developers need not fork the engine nor rewrite the serving code to move between vendors. RadixArk serves DeepSeek V4 Pro on AMD Instinct™ MI350X and MI355X GPUs hosted on DigitalOcean. As of the June 2026 InferenceX leaderboard, the deployment cleared over 3.5K tokens per second per GPU.
Yichi Zhang, an SGLang community engineer, shares the SGLang Cookbook—a set of recipes for launching SGLang on hardware for a given task, using Qwen3-30B-A3B.
SGLang, vLLM, and TensorRT-LLM all serve LLMs at scale. They differ in how they cache memory, which hardware they target, and how much setup they demand:
| Point of comparison | SGLang | vLLM | TensorRT-LLM |
|---|---|---|---|
| Maintainer | LMSYS/UC Berkeley Sky Computing Lab | UC Berkeley (Sky Computing Lab) | NVIDIA |
| Core mechanism for cache handling | RadixAttention (radix-tree KV cache reuse) | PagedAttention (paged KV cache) | Compiled kernels tuned per NVIDIA GPU |
| Hardware support | NVIDIA and AMD, one codebase | Primarily NVIDIA, with some AMD/CPU support | NVIDIA only |
| Use case | Multi-step agent pipelines with repeated prompt prefixes | General-purpose high-throughput serving | Peak throughput on NVIDIA hardware once compiled |
Getting a frontier model to run well on a new GPU vendor usually takes more than swapping a config file. Learn more about how RadixArk moved to AMD Instinct™ MI350X GPU Droplets and co-engineered a ~10x throughput gain with DigitalOcean and AMD teams.
SGLang splits serving into a program layer and an execution layer. Then, it optimizes the execution layer with a cache, a scheduler, and a set of low-level kernels. Each workflow handles part of that path, starting with the frontend language and runtime that turns a multi-call program into something the GPU can run:
SGLang architecture: SGLang operates as two layers: a Python-embedded frontend for writing multi-call LLM programs, and a runtime for executing and scheduling them. The frontend adds primitives such as sgl.gen() and sgl.function(), enabling a program to branch, loop, or fork across generation calls. The runtime routes those calls through the caching, batching, and kernel layers.
RadixAttention: RadixAttention stores every request’s KV cache in a shared radix tree, indexed by token sequence. A new request walks the tree, and reuses cached KV entries for any prefix it shares with an earlier request—computing only the tokens past the shared branch. For example, a support bot serving thousands of tickets with the same opening system prompt computes the prompt once, then every subsequent ticket pulls it straight from the tree.
SGLang continuous batching: SGLang scheduler adds a new request to a running batch the moment a GPU slot opens, and removes a request the moment it finishes generating. Static batching (common in older serving systems) holds every request in a batch until the slowest one finishes, leaving the GPU idle in the meantime—even when faster requests in that batch are already completed. Continuous batching keeps the GPU near full utilization under real, uneven traffic.
SGLang quantization: Quantization stores model weights in fewer bits than the original 16- or 32-bit format. INT8 quantization packs a weight into 8 bits, cutting memory footprint roughly in half and speeding up the matrix multiplication behind every generated token. SGLang also supports several lower-precision formats like INT4, INT8, and FP8, trading a small, measurable drop in accuracy for lower memory use and faster inference.
SGLang Triton integration: Triton Inference Server (NVIDIA’s open source model-serving software) hosts SGLang as a backend, wrapping its runtime in Triton’s request-routing layer. A team already running Triton for other models can add an SGLang-served LLM without standing up a separate serving stack. A team with no existing Triton deployment can use the SGLang server command- sglang.launch_server directly on a virtual machine like a DigitalOcean GPU Droplet.
SGLang FlashInfer integration: FlashInfer (open-source library and kernel generator) supplies kernels for attention and decoding, compiled for the KV cache layout RadixAttention produces. SGLang calls these kernels directly during SGLang chunked prefill and decode. The call cuts the low-level compute time behind every cache lookup and token generation. SGLang docs detail the full list of supported primitives and flags.
Skip manual installation overhead. With a few clicks, deploy a GPU Droplet with SGLang, ROCm, or JupyterLab.
SGLang deployment fits best when your workload needs more than a single model call—consider these patterns:
Serving multi-step or agentic LLM workflows: For example, if you’re building an AI agent that extracts a shipping address, feeds it into a rate-lookup call, and then sends a confirmation message. The pipeline only works if each step hands off something the next step can parse. SGLang structured generation functions constrain each call’s output to a form that the next step expects. The chain keeps running instead of breaking on a response your code can’t read.
Needing strict JSON or schema-constrained output: Constrained decoding checks the output against a schema or regex, so the model can’t produce anything outside that format in the first place. In this example, the SGLang function locks a food order down to a fixed JSON shape no matter how the input is phrased:
import sglang as sgl
@sgl.function
def extract_order(s, text):
s += text
s += sgl.gen("order", regex=r'\{"item": "[a-zA-Z ]+", "qty": [0-9]+\}')
extract_order.run(text="Two large coffees, please.")
@sgl.function
def chat(s, question):
s += sgl.system("You are a helpful support agent for a SaaS product.")
s += sgl.user(question)
s += sgl.assistant(sgl.gen("answer"))
Running high-concurrency production inference: If you’re building a chat feature that needs to handle hundreds of simultaneous sessions, the SGLang scheduler handles the load through continuous batching. It keeps the GPU processing a full batch at all times by adding and dropping requests as they come in or reach completion. Pair that with SGLang built-in quantization to fit more concurrent requests in memory—a single GPU can serve hundreds of chat sessions.
Deploying one codebase across NVIDIA and AMD GPUs: The SGLang setup can run on either vendor’s hardware, helping you avoid lock-in and work around GPU availability gaps. In other words, one less serving stack to fork and maintain per hardware target.
Our tutorial walks through deploying Qwen 3 on a GPU Droplet, a real open-weight model you can serve with SGLang using continuous batching and quantization in a live deployment.
The SGLang LLM serving framework is built for AI enterprises running large-scale, production inference. Not every team wants to run an LLM themselves. Some might only need to load a model and get answers, without high traffic or complex serving needs. Optimizing for large-scale production use comes with tradeoffs worth understanding before adopting it:
Steep setup: RadixAttention, continuous batching, and quantization pay off most for teams running production workloads. A small team without that infrastructure or tuning experience can experience setup overload.
Large-scale traffic required for best gains: RadixAttention prefix-caching payoff grows with concurrency and repeated prompt patterns.
Hardware-specific tuning: Cross-hardware support for NVIDIA and AMD GPUs doesn’t mean SGLang runs at peak speed on both. Reaching peak speed on either one still takes work tuned to that specific chip and kernel configuration, which SGLang’s shared codebase doesn’t handle automatically. Even RadixArk, the company with the deepest technical stake in SGLang, enacted a joint engineering effort with AMD to enable HIP graph support before its own AMD deployment hit peak throughput.
Heavier than necessary for simple use cases: A single-model, low-complexity deployment doesn’t require SGLang’s full runtime. The added machinery costs more setup time than the workload calls for.
No built-in lightweight mode: SGLang doesn’t offer a stripped-down option for quick prototyping. Mini SGLang was created as a separate compact reimplementation to make SGLang-style serving easier to understand and to accelerate research prototyping.
One model per server instance: SGLang supports most open-weight architectures like Llama and Qwen. However, a single server process loads and serves one model at a time. Serving multiple models in the same environment requires launching separate instances, each dedicated to its own GPU memory footprint, meaning compute costs scale per loaded model rather than sharing a single memory pool.
Running several models means paying for separate SGLang instances—and their own slices of GPU memory. Our guide to the best LLM routers covers how to route requests across providers without provisioning the GPU capacity yourself.
A benchmark number doesn’t tell you whether an agent pipeline holds up under real enterprise AI traffic, or whether a training run actually finishes on schedule across a thousand GPUs. SGLang can be used across production agent workloads, training pipelines, and multi-tenant deployments.
SGLang structured generation enforces strict JSON or regex-constrained output, so a multi-step AI agent doesn’t stall on a response its own code can’t parse.
Abdel Hamid, an AI educator, walks through deploying an LLM serving framework with Low-Rank Adaptation (LoRA) into a production sentiment-analysis.
The faster runtime that speeds up text generation also accelerates text-to-image and text-to-video diffusion models like Wan, Hunyuan, and Flux.
Yichi Zhang, an engineer on the SGLang open source community, runs SGLang Diffusion using the Google Colab platform on a single A100 GPU.
Setting up a large GPU cluster for a new model release used to take a dedicated infrastructure team days of manual setup. SGLang closes that gap through Open Model Engine (OME), a Kubernetes operator built for enterprise-grade LLM deployment.
Yineng Zhang, an SGLang core maintainer, walks through an example of the SGLang and OME integration.
Extended, iterative agent workflows, test and rewrite code over many cycles. Such workflows need a serving layer that doesn’t become the bottleneck as the loop runs longer.
Ligeng Zhu, a research scientist at NVIDIA Research, demonstrates Humanize—an agentic flow framework built for long-running tasks.
Serving a large model with one trillion parameters across several GPU nodes traditionally requires manually configuring node ranks and host IPs on each machine.
Xinyu Zhang and Jeffrey Wang of Anyscale explain how pairing SGLang with Ray (an open source framework for distributing Python workloads across a cluster) removes that manual step.
Running SGLang in production comes with a real GPU bill attached. Our LLM cost calculation guide breaks down how to calculate LLM costs before you commit to hardware
The fastest way to get an SGLang server running on DigitalOcean is to skip manual install and Docker setup entirely.
The SGLang Marketplace 1-Click App deploys a preconfigured GPU Droplet with SGLang, ROCm, and JupyterLab already installed. For teams that require more control over the deployment (custom Docker images, multi-node configs, or non-AMD hardware), choose manual GPU Droplet setup instead.

The DigitalOcean SGLang 1-Click Marketplace app deploys the latest supported SGLang version on a ROCm-enabled GPU Droplet. One click creates the Droplet with SGLang, the latest supported version of ROCm already running inside a Docker image, and the latest supported version of JupyterLab. There’s no separate sglang install step or sglang docker build to run yourself.
The app bundles a hands-on tutorial notebook that walks through a working SGLang inference example inside Jupyter. The guide is useful as a starting SGLang inference script while setting up your first deployment.
There are two ways to work with the deployment:
Directly through JupyterLab, which is best for exploring notebooks or running the bundled tutorial. DigitalOcean recommends the JupyterLab path for first-time users.
Through the Docker container, which is better suited to a Python project headed for its own deployment.
The SGLang 1-Click Marketplace app’s preset AMD/ROCm image won’t fit every deployment. If you require a specific SGLang version, NVIDIA hardware, or a multi-node setup, consider these options:
SSH into the Droplet
Pull the SGLang Docker image
Run inference directly, with no managed orchestration layer in between. Store model weights on a Volumes block storage attachment so multi-GB checkpoints don’t need to be redownloaded for every provision.
DigitalOcean Kubernetes (DOKS) with multi-GPU node pools: Once a model requires more GPU nodes than a single Droplet can hold, run it across a DOKS cluster. Pairing SGLang with Open Model Engine(OME), the Kubernetes operator handles multi-node serving without configuring each node by hand.
Bare Metal GPUs: Bare Metal GPUs are dedicated, non-virtualized GPU hardware. They’re a fit for the largest Mixture of Expert (MoE) models (such as DeepSeek V4 Pro and Llama 3 405B). These models require SGLang multi-node tensor parallelism to spread across GPUs. Bare-metal GPUs provide full interconnect bandwidth, with no hypervisor layer competing for it.
Before deploying, review SGLang specs to understand what ships inside the image, package versions, licenses, and setup steps included.
Is SGLang faster than vLLM?
SGLang and vLLM optimize different things. SGLang RadixAttention targets requests with shared prompt prefixes, while continuous batching targets general-purpose memory efficiency. For workloads with repeated system prompts or conversation history, SGLang cache reuse gives an edge; on more varied, single-shot requests,vLLM is preferred.
Who is behind SGLang?
SGLang was introduced by researchers affiliated with LMSYS Organization, the same group behind Chatbot Arena, and published as a NeurIPS 2024 paper. Since then, companies like NVIDIA, LinkedIn, and xAI have adopted SGLang to serve models in production.
What is continuous batching in LLM inference?
Continuous batching is a scheduling technique that adds a new request to a running batch the moment a GPU slot opens, and removes a request the moment it finishes generating. Older serving systems used static batching, which held a fixed group of requests together until the slowest one completed, leaving faster GPUs idle in between. Continuous batching keeps the GPU near full utilization under real, uneven traffic, which is why frameworks like SGLang build it in as a core feature.
What are the benefits of SGLang?
SGLang combines RadixAttention’s prefix caching, continuous batching, and quantization into one runtime. A single deployment handles high-concurrency, multi-step LLM workloads without stitching together separate tools. It also runs the same codebase on NVIDIA and AMD GPUs, which keeps teams from needing to maintain a separate fork per hardware vendor.
How do you serve long-context (1M token) models in production?
SGLang prefix caching and continuous batching keep throughput stable as context length grows into millions of tokens. Teams can deploy this setup on DigitalOcean’s GPU Droplets or through the SGLang Marketplace 1-click app, which handles the underlying infrastructure. Similarly, DigitalOcean Inference Router routes cache-aware, which keeps a session bound to the same model, so its warm cache doesn’t get discarded mid-task by a switch to a cheaper one.
Which inference platforms offer prompt caching?
SGLang’s RadixAttention is one such mechanism, reusing cached KV entries for repeated prompt prefixes. DigitalOcean hosts production SGLang deployments, like RadixArk’s, where caching runs directly on AMD Instinct GPUs. DigitalOcean also offers a cache-aware Inference Router that keeps sessions on the model that already holds the warm cache.
Which inference provider has the best caching to reduce token costs for long autonomous coding sessions?
For a long, iterative coding session, SGLang’s RadixAttention caches a shared system prompt or file context instead of recomputing it on every call, cutting the token cost of every repeated turn. The DigitalOcean cache-aware Inference Router helps reduce costs by reusing the same files in sessions.
Skip the manual setup and get SGLang serving in production. DigitalOcean gives you GPU hardware built for the workloads SGLang was designed to handle, from a single Droplet to a full multi-node cluster:
Deploy the SGLang Marketplace 1-Click App and get a GPU Droplet with SGLang, ROCm, and JupyterLab already installed.
Choose a manual GPU Droplet setup for a specific SGLang version, a custom Docker image, or NVIDIA hardware.
Scale to DOKS with multi-GPU node pools once a model outgrows a single Droplet.
Move to Bare Metal GPUs for the largest MoE models, with full interconnect bandwidth and no hypervisor overhead.
Route through DigitalOcean cache-aware Inference Router, keeping an agentic session on the same model so its warm cache doesn’t get discarded mid-task.
Store model weights on the Volumes block storage so multi-GB checkpoints don’t need to be redownloaded on every provision.
Get started with SGLang on DigitalOcean.
Sujatha R is a Technical Writer at DigitalOcean. She has over 10+ years of experience creating clear and engaging technical documentation, specializing in cloud computing, artificial intelligence, and machine learning. ✍️ She combines her technical expertise with a passion for technology that helps developers and tech enthusiasts uncover the cloud’s complexity.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
