Technology · Agentic → Structured Output · Open Source · wiki:deep

Guidance

Guidance is a guidance language for controlling LLMs: compose prompts with Python context managers (system/user/assistant) and constrained generators — free gen, regex-constrained generation, select over options, and Pydantic/JSON schema generation (gen_json). Models are immutable copies (Transformers, LlamaCpp, mocks, and others). Related runtime work lives in llguidance (Rust). MIT. Last primary push noted mid-2026 in the pack map — verify activity before locking.

Why it matters here

Agent tool protocols and ledger-bound records need generation that cannot emit invalid shapes. Guidance is the research pick when you want a programmable mix of free text and hard constraints at decode time. Prefer Instructor for pragmatic multi-provider Pydantic extraction in app code; prefer Outlines for grammar/schema-guided decoding especially on self-hosted backends; prefer LMQL for query-language + research constraint programming (check maintenance).

How it works

You build an immutable model session, append role blocks, and call generators that mask or constrain tokens. Captured named fields land on the model object for downstream Python use.

  1. Load a local/API model backend.
  2. Compose system/user/assistant blocks.
  3. Constrain with gen/select/regex/gen_json.
  4. Read named captures; validate further in app code if needed.

Related: instructor · lmql · outlines · topics/12-central-nervous-system

Flow

Scroll inside the canvas to pan

When to reach for it

  • Use when: you need programmable constrained generation (regex, choice, JSON schema) interleaved with prompt control flow.
  • Skip when: simple chat+JSON mode + Pydantic retries suffice (instructor), or you already standardize on Outlines grammars.
  • Prefer instead: Instructor for API extraction; Outlines for engine-level structured generation guarantees.

Limits

  • Backend coupling: strength depends on local/logit-control backends vs thin API wrappers.
  • Not the ledger: valid JSON ≠ authorized action.
  • Maintenance check: confirm repo activity vs peers before production lock.
  • Learning curve: DSL + grammar composition is heavier than Instructor’s one-liner.

Linked from

What we checked

Claims below are backed by science sources on disk.

Language / control role

guidance-ai/guidance · MODERATE

A guidance language for controlling large language models.

Contrast vs LMQL

LMQL contrast · MODERATE

A language for constraint-guided and efficient LLM programming.

Contrast vs Outlines

Outlines contrast · MODERATE

Structured outputs for LLMs

In this research stack

Features and peers linked from the catalog map — not a second product surface.

Features it supports

Same cell

Stack

Document management

No DM vendor crosswalk edges yet.

Source

Primary repo github.com/guidance-ai/guidance · Open Source

technologies/guidance/README.md

Research inventory

9 tags · 7 out · 8 in · 3 artifacts · 1 gaps · 28 corpus docs

Catalog tags

landscape.layer
Agentic
landscape.subcategory
Structured Output
license_tag
Open Source
maps.dm
absent
maps.features
4
one_liner
Agentic
review.depth
science
slug
guidance
title
Guidance

Artifacts

  • dm_map · absent
  • features_map · present · technologies/guidance/features.md
  • readme · present · technologies/guidance/README.md

Out · alternative_to

Out · maps_to

In · alternative_to

In · in_stack

In · maps_to

Corpus tags

category
Agentic → Structured Output
dedication
open-source
feature
closed-execution-loop
outcome-verification
testing-debugging-optimization
wt-intelligence
kind
map_edge
tech_features
tech_quote
tech_readme
tech_science_source
tech_section
needs_deepen
false
quality
ok
section
Evidence
Features map
GitHub map
How it works
Limits & failure modes
Links
Scientific notes
What it is
When to use / skip
Why it matters here
slug
guidance
source_id
guidance-github
lmql-contrast
outlines-contrast
technology
guidance

Corpus documents (28)

map_edge · 4

  • guidance → closed-execution-loop
  • guidance → outcome-verification
  • guidance → testing-debugging-optimization
  • guidance → wt-intelligence

tech_features · 1

  • Guidance · features

tech_quote · 9

  • Guidance · guidance-github
  • Guidance · guidance-github
  • Guidance · guidance-github
  • Guidance · lmql-contrast
  • Guidance · lmql-contrast
  • Guidance · lmql-contrast
  • Guidance · outlines-contrast
  • Guidance · outlines-contrast
  • … +1 more

tech_readme · 1

  • Guidance

tech_science_source · 3

  • Guidance · guidance-github
  • Guidance · lmql-contrast
  • Guidance · outlines-contrast

tech_section · 10

  • Guidance · Evidence
  • Guidance · Features map
  • Guidance · GitHub map
  • Guidance · How it works
  • Guidance · Limits & failure modes
  • Guidance · Links
  • Guidance · Scientific notes
  • Guidance · What it is
  • … +2 more