Guidance
An open-source Python library for steering LLMs with native control flow, regex, and CFG constraints.
Guidance is a fantastic learning tool for constrained generation, but it's a dead end for new production projects. Its Pythonic API and grammar-based control are still among the best examples of the pattern; use it to master the concepts, then move to an active library like Outlines or LMQL.
Verified 8d ago · liveness 78/100 · cite: rightaichoice.com/tools/guidance
- Developers learning constrained generation with a Pythonic API
- Researchers prototyping grammar-based decoding offline with Mock model
- Maintaining legacy code that already depends on Guidance
- Educators teaching LLM output control and structuring
- New production projects needing ongoing maintenance and support
- Teams requiring compatibility with the latest model backends
- High-stakes applications where reliability and updates are critical
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're starting a new production project, need ongoing maintenance and support, or require compatibility with the latest model backends.
No monetary cost, but you lose community support and security patches since the repo was archived in October 2023.
Guidance is free and open source under MIT, so it costs nothing to try—ideal for learning or prototyping. Compared to hosted services that charge per token, you only pay for the underlying model compute. But for production, actively maintained alternatives like Outlines are worth their cost in reliability.
In short
Guidance — An open-source Python library for steering LLMs with native control flow, regex, and CFG constraints. Best for Developers learning constrained generation with a Pythonic API, Researchers prototyping grammar-based decoding offline with Mock model, Maintaining legacy code that already depends on Guidance. Free to use.
What's new in Guidance
Checked 8 days agoAcross the latest 1 update: 1 changelog entry.
Viability Score
How well maintained and how widely used is Guidance? Built from what the vendor actually publishes (docs, changelog, tutorials, integrations, pricing), whether the site is live, and how much real users discuss it. How we calculate this
Last calculated: September 2026
How we score →Key Features
- Pythonic control flow (loops, conditionals, tool use) interleaved with generation
- gen(regex=...) to enforce regular expression output
- select() to force a choice from a predefined list
- Context-free grammar (CFG) constraint support
- @guidance decorator for reusable prompt functions
- Mock model for offline grammar validation
- Jupyter notebook widget for interactive generation view
- Immutable model objects for safe state copying
- Capture generated text into named variables
- Supports Transformers, llama.cpp, and OpenAI backends
- Reduces latency and cost vs conventional prompting or fine-tuning
- MIT license, free via PyPI
About Guidance
Guidance is an open-source Python library for steering large language model output through native Python control flow rather than brittle prompt engineering. Instead of composing free-form prompts, you write loops, conditionals, tool use, and generation directly in code with a Pythonic API, letting you guarantee structured output such as JSON, code, or multiple-choice answers. Launched in 2022, Guidance was among the first frameworks to make constrained generation practical, reducing latency and cost versus conventional prompting or fine-tuning. It remains a valuable educational tool and a solid foundation for understanding grammar-based decoding, even though the original repository was archived in late 2023 and no longer receives updates. The core interface is centered on a few primitives: `gen()` generates text with optional `regex` constraints to enforce any regular expression, while `select()` forces the model to pick from a predefined list—ideal for A/B/C/D questions or fixed taxonomies. The `@guidance` decorator lets you build reusable prompt functions, like a `zero_shot_multiple_choice` helper that automatically formats questions and enforces a valid selection. You can also capture generated text into named variables and reference them later, making complex multi-step workflows straightforward. Development is well supported. The `Mock` model lets you validate grammars offline without making any model API calls, and the Jupyter notebook widget gives an interactive view of the generation process. Model objects are immutable, simplifying debugging and experimentation. The library supports several backends—Transformers, llama.cpp, and OpenAI—and is distributed under the MIT license via PyPI. Guidance's main limitation is its maintenance status: the repository was archived on October 22, 2023, meaning no new features or bug fixes. For teams starting fresh production work, actively maintained alternatives like Outlines or LMQL are safer bets. But for learning
Behind the Verdict
Guidance's greatest strength is its Pythonic, readable API for constrained generation. You express control flow with `if` statements and loops inside the prompt template, which is far more natural than the string-composition approach of many alternatives. The `gen(regex=...)` and `select()` primitives are simple yet expressive, and the `@guidance` decorator promotes code reuse. The immutable model object model makes debugging straightforward—each step returns a new state you can inspect. The offline `Mock` model is a nice touch for testing grammars without burning API tokens. Where Guidance falls short is maintenance. The repository was archived on October 22, 2023, so you won't get bug fixes, security patches, or support for newer model backends. If you need reliability for a production system, you're better off with Outlines, which is actively maintained and offers similar regex/CFG constraints, or LMQL, which adds a more expressive query language. Guidance also assumes logit-level access for hard guarantees—if you're using a hosted API that doesn't expose logprobs, you may not get true enforcement. For learning the fundamentals of grammar-based decoding, Guidance is still an excellent reference. The code is clean, the concepts are well-illustrated, and running it with a local model is straightforward. Use it as a teaching tool, or as a starting point to understand what you want from a production library. For new projects, plan to migrate to a maintained alternative.
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 JSON from a local Llama model for a one-off data pipeline task.
Outcome: You install Guidance, write a simple gen(regex=...) to enforce JSON syntax, and get a reliable parser in under an hour without fine-tuning.
You want to understand how grammar-based decoding works and experiment interactively in a Jupyter notebook.
Outcome: You use the Mock model to test different regex patterns, see the generation process in the widget, and build a mental model of constrained generation—all free and offline.
You have an old service that uses Guidance for a structured chain-of-thought prompt, and it still works.
Outcome: You keep the dependency pinned, verify it works with your current backend, and avoid upgrading since no new features are coming.
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-08-31
Limitations
- The repository is archived and no longer maintained as of October 2023, though it remains installable via pip.
- Constrained generation guarantees may depend on logit-level access, and some integrations may require specific library versions.
- The template language has a learning curve, and it is not an agent/orchestration framework.
as of 2026-08-30
Verification history
We have re-verified Guidance 19 times since . Each pass re-reads the vendor's own pages and re-checks every listed field against that evidence; passes where nothing had changed are marked as such.
- — re-verified summary, description, our verdict, our analysis, pricing model, pricing tiers, features, integrations, who it suits, who should skip it
- — re-verified summary, description, our verdict, our analysis, pricing model, pricing tiers, features, integrations, who it suits, who should skip it
- — re-verified summary, description, our verdict, our analysis, pricing model, pricing tiers, features, integrations, who it suits, who should skip it
- — re-verified summary, description, our verdict, our analysis, pricing model, pricing tiers, features, integrations, who it suits, who should skip it
- — re-verified summary, description, our verdict, our analysis, pricing model, pricing tiers, features, integrations, who it suits, who should skip it
- — re-verified summary, description, our verdict, our analysis, pricing model, pricing tiers, features, integrations, who it suits, who should skip it
Showing the 6 most recent of 19 verification passes.
Free to cite with attribution — this page re-verifies continuously.
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.
Plans compared
For each published Guidance tier: who it actually fits, and what it adds vs. the previous tier. Cross-reference the cost calculator above for projected annual outlay.
Open Source
$0/mo
Ideal for
Solo developers or researchers wanting to learn constrained generation or prototype with a free library, without needing commercial support.
What this tier adds
Free entry point: MIT license, full source, core features (gen(), select(), decorator), Mock model, and Jupyter widget, all at $0/mo.
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 and open source under MIT, so it costs nothing to try—ideal for learning or prototyping. Compared to hosted services that charge per token, you only pay for the underlying model compute. But for production, actively maintained alternatives like Outlines are worth their cost in reliability.
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.
For a quick experiment: install via pip and run your first constrained generation in under 10 minutes, assuming you already have a compatible backend (Transformers, llama.cpp, or OpenAI). For learning the API thoroughly, budget a few hours to get comfortable with the decorator, gen(), and select(). The Mock model lets you practice offline without any API setup.
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 manual prompt string formatting: replace f-strings with Guidance's @guidance decorator and gen() calls to gain structured output guarantees.
- →From an unconstrained chat API: wrap your calls with Guidance to enforce output formats (e.g., JSON, SQL) without rewriting your entire pipeline.
- ↗To Outlines: rewrite Guidance grammars using Outlines's regex and CFG constraints; the Pythonic style is similar, easing the transition.
- ↗To LMQL: encode your control-flow logic in LMQL's query language, which supports similar constraints and interleaving.
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 allVercel AI SDK
Open-source TypeScript toolkit for building AI apps with 100+ models, streaming, and agent support
SwiftOpenAI
Open-source Swift package wrapping the OpenAI API with async/await and Combine.
Frequently Asked Questions
Categories
Used Guidance? Help shape our editorial sentiment research.


