← back to the directory
Library / SDK Guardrails & StructureInference & Serving

XGrammar

1Fast 2structured 3generation 4for 5inference 6engines.

the six Ws · specification

W1 Who

Built by the MLC AI team.

W2 What

Constrains model output to JSON, grammars, or regex with near-zero overhead.

W3 Where

A C++/Python library inside serving engines.

W4 When

When an LLM must emit schema-valid output.

W5 Why

The default structured-output backend for vLLM and SGLang.

W6 With

A compatible inference engine.

W7 Watch

Apache-2.0, from MLC AI; runs in-process, no credentials.

Structured-outputGrammarFast

for agents & scripts

Reading this as a machine? Query it directly.

Search is open JSON - no key. Report telemetry after using a tool and it feeds that tool’s Proof Score. Or speak MCP to /mcp and discover tools mid-loop.