Guidance
Pythonic constrained LLM generation with regex and CFGs
Guidance pioneered an elegant approach to structured LLM output, but the archive status makes it a non-starter for any new project. Only use it to learn or if you're maintaining a legacy codebase. For production, look at Outlines or LMQL instead.
Verified 17d ago · liveness 69/100 · cite: rightaichoice.com/tools/guidance
- Developers needing guaranteed structured output from LLMs for learning or legacy code
- Researchers prototyping constrained generation techniques in a controlled environment
- Education: understanding token-level programmatic control and grammar-based decoding
- Offline grammar testing before deployment using Mock model without API costs
- Production systems requiring ongoing maintenance, updates, or support
- Projects using the latest LLMs or backends not present in the archived codebase
- Teams needing commercial support, SLAs, or guaranteed compatibility
We scan live Reddit threads, YouTube comments, X posts, G2 reviews and other communities — and hand you an honest verdict in under a minute.
- Honest verdict, not marketing
- Real pros & cons from real users
- Attributed quotes with receipts
3 free scans · no card needed
Skip Guidance if you need a maintained, production-ready library for constrained LLM generation.
Guidance is free (MIT license). There are no tiers, usage caps, or hidden costs—you only pay for the underlying LLM inference (OpenAI, local model compute).
In short
Guidance — Pythonic constrained LLM generation with regex and CFGs. Best for Developers needing guaranteed structured output from LLMs for learning or legacy code, Researchers prototyping constrained generation techniques in a controlled environment, Education: understanding token-level programmatic control and grammar-based decoding. Free to use.
Viability Score
How likely is Guidance to still be operational in 12 months? Based on 4 signals — momentum (how recently it shipped), wrapper dependency, revenue model, and web presence.
Last calculated: July 2026
How we score →Key Features
- @guidance decorator for reusable LLM functions
- Constrained generation with regex and CFGs
- Interleaved Python control flow (loops, conditionals) with generation
- Mutable model objects capturing output in variables
- select() for forced-choice from predefined options
- Mock model for offline grammar validation and debugging
- Support for Hugging Face Transformers backend
- Support for llama.cpp backend
- Support for OpenAI API backend
- Rich Jupyter notebook widget for interactive display
- Reduced latency vs conventional prompting by streaming tokens
- Grammar-based output guarantee without post-processing
- Zero external API calls when using Mock model
- Composable guidance functions for modular prompt design
- Open source MIT license
About Guidance
Guidance is an open-source Python library that gives developers fine-grained control over large language model output by interweaving generation with standard Python control flow—loops, conditionals, and tool use—and enforcing constraints via regular expressions and context-free grammars. It provides a @guidance decorator for creating reusable functions, mutable model objects to capture structured output into variables, and a Mock model for offline grammar validation without making API calls. The library supports multiple backends including Hugging Face Transformers, llama.cpp, and OpenAI, making it versatile for various deployment scenarios. Guidance also offers a rich Jupyter notebook widget for interactive display and uses a streaming approach that can reduce latency compared to conventional prompting. However, the repository was archived in October 2023 and is no longer maintained, which means no bug fixes, backend updates, or community support are provided. This makes Guidance unsuitable for new production projects, but it remains valuable for educational purposes, understanding constrained generation techniques, and maintaining legacy code that already depends on it. For active alternatives, consider Outlines, LMQL, or LangChain output parsers.
Behind the Verdict
Guidance was one of the first libraries to let you treat LLM generation as a first-class citizen within Python control flow. The @guidance decorator and constraint system are genuinely clever—you could write a loop that calls the model and parses results without post-processing. The Mock model for offline testing is a standout feature; you can validate your regex or CFG constraints against test strings without spending a dime on API calls. But the archive status is a deal-breaker for production. Since October 2023, there have been zero updates. New LLM backends (like Anthropic or Gemini) aren't supported, and even existing backends may break as upstream APIs change. The project is effectively frozen. Compared to Outlines, which is actively maintained and supports more backends (including vLLM and ExLlama), Guidance is strictly a historical artifact now. Outlines offers similar constrained generation but with ongoing development and broader model support. If you absolutely need the Pythonic control flow style, LMQL provides a query-language approach that is also actively developed. Where Guidance still shines: as a teaching tool. It's a compact codebase (under 2,000 commits) for understanding how token-level constraints work. We'd recommend it for a weekend hack to learn the concepts, then switch to Outlines for anything real. The widget integration with Jupyter notebooks is another nice touch, making it easy to experiment interactively. Just don't build a business on it.
Researching Guidance? Get your full AI stack in 60 seconds.
Free, no signup — tell us your goal and get tools matched to your budget & existing stack.
Real-world workflow fit
Concrete scenarios for the personas Guidance actually fits — and what changes day-one when you adopt it.
You need to extract specific JSON fields from a model, guaranteeing the output matches a regex pattern.
Outcome: With gen(regex=...), you get directly usable JSON without post-processing, saving hours of parsing and validation code.
You want to test CFG constraints on a small local model before deploying to larger ones.
Outcome: Using the Mock model, you can validate grammar correctness offline without any API costs, then switch backends seamlessly.
You need to call an LLM inside an existing function that expects structured output, and you want to keep code clean.
Outcome: The @guidance decorator lets you embed LLM calls as reusable functions that integrate naturally with your existing Python control flow.
Use Cases
- Extract structured JSON from local LLMs with regex constraints
- Generate syntactically correct SQL from an open-source model
- Enforce multi-role chat format in a local Llama model
- Speed up structured generation by skipping fixed template tokens
- Prototype constrained generation techniques offline with mock model
Models Under the Hood
as of 2026-07-14
Limitations
- Strong guarantees require logit-level access (local models).
- On OpenAI/Azure constraints are best-effort.
- Template language has a learning curve.
- Some integrations require specific library versions.
- Not an agent/orchestration framework; pair with other tools for complex workflows.
as of 2026-06-30
12-month cost
Project the real annual outlay, including the implied monthly cost when only an annual tier is published.
Vendor list price only. Add-on usage, seat overages, and contract minimums are surfaced under Hidden costs & gotchas.
Where the pricing makes sense
The company stage and team size where Guidance's pricing actually pencils out — and where peers do it cheaper.
Guidance is free (MIT license). There are no tiers, usage caps, or hidden costs—you only pay for the underlying LLM inference (OpenAI, local model compute).
Setup time & first value
How long it actually takes to get something useful out of Guidance — broken out by persona, not the marketing-page minute.
If you already have Python and a supported backend (Transformers, llama.cpp, or OpenAI API key), install via pip install guidance and get your first constrained generation in about 10 minutes. The Jupyter notebook examples in the repo get you started even faster.
Switching to or from Guidance
How to bring data in from common predecessors and how to get it back out — written for the switcher, not the buyer.
- →From Jinja2 templates: Swap to Guidance decorators for structured, composable prompts with built-in constraints.
- ↗To Outlines: Replace gen(regex=...) with outlines.generate.regex for similar constraints, actively maintained.
- ↗To LangChain output parsers: Use RunnableSequence + StructuredOutputParser for broader ecosystem and production support.
Integrations
Resources & Guides
Tutorials & Learning
Official links
Tools that pair well with Guidance
Common stack mates teams adopt alongside Guidance, with the specific reason each pairing earns its keep.
Alternatives to Guidance
View allFrequently Asked Questions
Categories
Used Guidance? Help shape our editorial sentiment research.


