Glossary

SGLang

SGLang is a fast LLM serving framework that reuses cached work across requests sharing the same prefix and enforces JSON output with little slowdown, which makes it a strong fit for agent and chat workloads.

General definition

SGLang (Structured Generation Language) is an open-source inference framework from the LMSYS group that started at UC Berkeley, the team behind Chatbot Arena. It has two parts: a runtime that serves models on GPUs, and a frontend language for writing multi-step LLM programs. The runtime is what most teams deploy; it is released under the Apache 2.0 licence and offers an OpenAI-compatible server out of the box.

  • RadixAttention: keeps the KV cache of previous requests in a radix tree so any new request that shares a prefix (the same system prompt, the same chat history, the same few-shot examples) reuses it automatically; a form of prompt caching that needs no changes on the client
  • Fast structured output: JSON schemas and regular expressions are compiled into a grammar that is enforced during decoding with little throughput loss
  • Continuous batching, tensor and data parallelism, quantisation and speculative decoding, in line with other modern servers
  • Multi-modal models, and a reputation for serving DeepSeek and other large mixture-of-experts models well

The frontend language lets you write a generation program (a call, a branch, a parallel fan-out, a constrained field) in Python and have the runtime schedule it efficiently. It is optional: plain OpenAI-style HTTP calls work without it, and that is how most applications use SGLang.

Compared with vLLM and Text Generation Inference, SGLang is the one to evaluate when many requests share long prefixes (agents with a large system prompt, chat with long histories, RAG with repeated context) or when most outputs must be valid JSON. vLLM has the broadest adoption and hardware coverage; TGI the tightest Hugging Face integration. All three are interchangeable behind an OpenAI-compatible endpoint, which is the point of modern model serving.

In the Ethora ecosystem

Ethora’s AI service talks to any OpenAI-compatible endpoint, so an SGLang server is a drop-in model backend: four environment variables (AI_API_URL, AI_API_KEY, AI_CHAT_MODEL, AI_EMBEDDING_MODEL) point the self-hosted AI agent stack at it, as the official Ollama example documents for a local runner. The endpoint is service-wide; each agent chooses a model name served there. RAG embeddings live in Postgres with pgvector at 256 dimensions and come from an embeddings endpoint, which SGLang can also provide for supported embedding models.

SGLang’s prefix caching happens to suit how Ethora agents work. Each agent has a system prompt and a per-room transcript memory, so successive requests from the same room share a long, identical prefix that RadixAttention serves from cache. Multi-agent rooms and the heartbeat scheduler add traffic that repeats context in the same way. When an Ethora deployment outgrows a CPU-only setup (a 3B model on a 4 vCPU, 8 GB machine measured 6 to 8 seconds per short reply), a GPU running SGLang or vLLM is the usual next step.

Get started

Build AI agents on your own stack

Ethora’s AI SDK brings agents, RAG and self-hosted LLMs into your product. Talk to our team.

Start Free
Free tier available Enterprise SLA No vendor lock-in