Control framework for interleaving generation, logic, and tool calls. This ai agent builders provides comprehensive solutions for businesses looking to optimize their operations.
Gives you fine-grained control over how AI generates text — mix instructions, logic, and AI responses in a single template.
Guidance is a prompting language from Microsoft Research that gives you precise control over LLM generation by interleaving template text with generation commands. Instead of writing a prompt and hoping the model formats its response correctly, you write a Guidance program that controls exactly where the model generates, what constraints apply, and how the output is structured.
The key insight is treating LLM interaction as a programming language, not a text completion. A Guidance program looks like a template with embedded commands: {{gen 'name' maxtokens=50}} for generation, {{select 'category' opticategories}} for constrained selection, {{#geneach 'items' numiterati3}} for repeated generation. The model generates only in specified slots, with template text serving as guaranteed context.
Guidance supports both API-based models (OpenAI, Anthropic, Azure) and local models (Transformers, llama.cpp). With local models, it uses token healing and constrained generation similar to Outlines. With API models, it uses prompt templating and output parsing.
Generation commands include: gen (open-ended with optional regex/stop constraints), select (choose from a list), geneach (generate multiple items), block/if/else (conditional generation), and function calls. These compose naturally for complex generation programs.
Guidance's acceleration features are notable: token healing corrects tokenization artifacts at generation boundaries, prefix caching reuses computation across calls, and the program structure enables efficient batching.
Honest assessment: Guidance is elegant and powerful for fine-grained output control. It's particularly good for complex extraction, form filling, and structured reasoning. However, it has a steeper learning curve, its community is smaller than major frameworks, and Microsoft's investment has been inconsistent. For teams that need precise output control and are willing to learn a new paradigm, Guidance offers unique capabilities.
Was this helpful?
Guidance from Microsoft offers a unique template-based approach to constraining LLM output with interleaved generation and control flow. Powerful for complex output structures but somewhat niche and less actively maintained than alternatives.
Interleave fixed template text with generation commands. The model only generates in specified slots, with template text providing guaranteed context. Variables capture generated values for downstream use.
Use Case:
Building a structured product review analyzer that forces the model to generate a sentiment, then a summary, then pros and cons — each in a controlled slot.
Constrain generation to exactly one of a predefined list. Works with both API and local models. On local models, uses logit masking for guaranteed compliance.
Use Case:
Classifying customer feedback into categories (bug, feature request, praise, complaint) with guaranteed output being exactly one category.
Automatically corrects tokenization artifacts at boundaries between template text and generated text. Prevents garbled output when template text ends mid-token.
Use Case:
Generating URLs or code where tokenization boundaries could corrupt the output after a fixed domain prefix.
if/else blocks for conditional paths and geneach for iterative generation. The model can generate variable-length lists and make branching decisions programmatically.
Use Case:
Generating a variable-length list of action items from meeting notes where the model decides how many items to generate.
Programs maintain state across generation steps — variables from earlier steps are available in later steps. Enables multi-step reasoning where each step builds on previous outputs.
Use Case:
Implementing chain-of-thought reasoning where the model generates a plan, then executes each step referencing the plan.
Works with OpenAI GPT-4, Anthropic Claude, Azure OpenAI, Transformers, and llama.cpp. Local backends support constrained generation; API backends use optimized prompting.
Use Case:
Developing locally with a small Transformers model, then deploying with GPT-4 for production — same program, different backend.
Free
forever
Ready to get started with Guidance?
View Pricing Options →Building complex structured generation programs that mix free-text with constrained choices and loops
Implementing multi-step reasoning pipelines where each step builds on previous generated outputs
Creating reliable classification and extraction systems using select and gen constraints
Developing template-based generation for forms, reports, and structured documents with format compliance
Guidance works with these platforms and services:
We believe in transparent reviews. Here's what Guidance doesn't handle well:
Regular prompting sends text and hopes the output follows your desired format. Guidance programs specify exactly where the model generates and what constraints apply. Fixed text is guaranteed verbatim; generation only happens in specified slots. It eliminates format parsing issues and reduces retries.
Yes. Guidance supports OpenAI's chat and completion APIs with output parsing. Note that constrained generation (logit masking) only works with local models — API models use prompt-based constraints instead, which are reliable but not mathematically guaranteed.
Guidance has periods of active development and quieter periods. It's from Microsoft Research and continues to receive updates but not at the pace of commercial-backed frameworks. Check the GitHub repo for recent commit activity before committing for production use.
Both support constrained generation with local models. Outlines focuses on JSON/regex/grammar constraints with FSM-based masking. Guidance provides a richer programming language with templates, conditionals, and loops. Outlines is better for pure structured data extraction; Guidance is better for complex programs mixing free-text and structured output.
Weekly insights on the latest AI tools, features, and trends delivered to your inbox.
In 2026, Guidance development continued with Microsoft maintaining compatibility with newer Azure OpenAI models, improved performance for constrained generation with Transformer models, and added support for stateful multi-turn conversation templates with branching control flow.
People who use this tool also find these helpful
A user-friendly AI agent building platform that simplifies the creation of intelligent automation workflows with drag-and-drop interfaces and pre-built components.
An innovative AI agent creation platform that enables users to build emotionally intelligent and creative AI agents with advanced personality customization and artistic capabilities.
The standard framework for building LLM applications with comprehensive tool integration, memory management, and agent orchestration capabilities.
CrewAI is an open-source Python framework for orchestrating autonomous AI agents that collaborate as a team to accomplish complex tasks. You define agents with specific roles, goals, and tools, then organize them into crews with defined workflows. Agents can delegate work to each other, share context, and execute multi-step processes like market research, content creation, or data analysis. CrewAI supports sequential and parallel task execution, integrates with popular LLMs, and provides memory systems for agent learning. It's one of the most popular multi-agent frameworks with a large community and extensive documentation.
Open-source standard that gives AI agents a common API to communicate, regardless of what framework built them. Free to implement. Backed by the AI Engineer Foundation but facing competition from Google's A2A and Anthropic's MCP.
Open-source CLI that scaffolds AI agent projects across frameworks like CrewAI, LangGraph, and LlamaStack with one command. Think create-react-app, but for agents.
See how Guidance compares to CrewAI and other alternatives
View Full Comparison →AI Agent Builders
CrewAI is an open-source Python framework for orchestrating autonomous AI agents that collaborate as a team to accomplish complex tasks. You define agents with specific roles, goals, and tools, then organize them into crews with defined workflows. Agents can delegate work to each other, share context, and execute multi-step processes like market research, content creation, or data analysis. CrewAI supports sequential and parallel task execution, integrates with popular LLMs, and provides memory systems for agent learning. It's one of the most popular multi-agent frameworks with a large community and extensive documentation.
Agent Frameworks
Open-source multi-agent framework from Microsoft Research with asynchronous architecture, AutoGen Studio GUI, and OpenTelemetry observability. Now part of the unified Microsoft Agent Framework alongside Semantic Kernel.
AI Agent Builders
Graph-based stateful orchestration runtime for agent loops.
AI Agent Builders
SDK for building AI agents with planners, memory, and connectors. - Enhanced AI-powered platform providing advanced capabilities for modern development and business workflows. Features comprehensive tooling, integrations, and scalable architecture designed for professional teams and enterprise environments.
No reviews yet. Be the first to share your experience!
Get started with Guidance and see if it's the right fit for your needs.
Get Started →Take our 60-second quiz to get personalized tool recommendations
Find Your Perfect AI Stack →Explore 20 ready-to-deploy AI agent templates for sales, support, dev, research, and operations.
Browse Agent Templates →