Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

xgrammar

Structured generation library - enables efficient constrained decoding for LLM outputs.

Prompts, structured output and evalsPYPI

Website

1. License

License from PyPI classifier.

xgrammar.mlc.ai/

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What xgrammar does

Structured generation library - enables efficient constrained decoding for LLM outputs.

xgrammar popularity

48 / 100
Gid Score, #2242 overall
1.6M
downloads a week, pypi
1
agent projects use it
xgrammar: downloads per weekPyPI, xgrammar 1,560,638

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How xgrammar is used

  • xgrammar is a dependency in 1 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 25 projects, and what it is used with below comes from all of them.
  • The most used alternative in our scan is Instructor (4 projects).
  • Projects that use it most often also use aiohttp (100.0%), AnyIO (100.0%), attrs (100.0%).

Often used with

In 100.0% of its projects
In 100.0% of its projects
In 100.0% of its projects
In 100.0% of its projects
In 100.0% of its projects
In 100.0% of its projects

More about xgrammar

More in Prompts, structured output and evals

Alternatives

xgrammar This page

Apache-2.0Gid 481.6M/wk

Instructor

Python library to get structured outputs from language models with validation and parsing.

MITGid 632.6M/wk

Compare xgrammar with another tool

Get started

Install it.

pip install xgrammar

No step-by-step start for xgrammar yet: we have not written its hand-checked card.