SGLang Chat Processor
SGLang-native preprocessing and postprocessing for chat completions
The SGLang chat processor enables SGLang-native preprocessing and postprocessing in the Dynamo frontend. It uses SGLang’s tokenizer, chat templates, tool call parser, and reasoning parser directly — bypassing the default Rust preprocessor for v1/chat/completions requests.
When to Use
Use --dyn-chat-processor sglang when Dynamo’s built-in Rust preprocessor does not yet support a tool call parser or reasoning parser you need. The SGLang processor delegates to SGLang’s Python implementations, so any parser SGLang supports works immediately.
Common cases:
- A tool call format not yet in the Rust
tool_callinglibrary - A reasoning parser not yet supported natively
- A chat template that the Rust preprocessor doesn’t handle correctly
If the parser you need is missing from the Rust preprocessor, consider opening an issue or PR to add native support — native parsers avoid the Python GIL overhead entirely.
Quick Start
DeepSeek Prompt Encoding
For DeepSeek V4 and V4.1 checkpoints identified by checkpoint metadata, the processor prefers SGLang’s recipe renderer when that module is available, including when the tokenizer has a chat template. An explicit --chat-template override takes precedence over checkpoint encoding. This path requires the checkpoint’s fast tokenizer and the deepseek-recipe package supplied by the SGLang installation. SGLang v0.5.22 keeps the existing V4 encoder path. V4.1 checkpoints without a chat template require the recipe renderer available in SGLang v0.5.23 or newer; they cannot fall back to the V4 encoder.
Recipe encoding rejects continue_final_message=true combined with thinking because the current output parser does not track the continued prompt’s reasoning state. Continuation with thinking disabled remains supported.
Dynamo continues to own sampling settings, constrained decoding, and output parsing. Image URLs must match the recipe’s placeholder order; requests with a different order or UUID-only images are rejected before inference.
Frontend Arguments
These arguments are passed to the frontend (not the worker) when using --dyn-chat-processor sglang:
Environment Variables
Tool Calling
The processor supports all SGLang tool call formats. Pass --tool-call-parser on the frontend:
Any parser supported by SGLang can be used. See the SGLang documentation for the full list of available tool call parsers.
Example: Tool Call Request
Response:
Reasoning Parsing
For models that produce chain-of-thought reasoning (e.g., Qwen3, DeepSeek-R1), pass --reasoning-parser:
The parser separates think tag content into the reasoning_content field and regular content into the content field.
Migration from --use-sglang-tokenizer
--use-sglang-tokenizer on the worker is deprecated. Replace with --dyn-chat-processor sglang on the frontend:
Key differences:
See Also
- Tool Calling: General tool calling guide
- Reference Guide: Full SGLang backend reference
- Agentic Workloads: Priority scheduling and KV cache tuning