guidance

Enforces regex and grammar constraints to generate validated JSON or XML outputs.

4|1|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/arm2arm/AstroAgentAssistant --skill guidance-arm2arm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/arm2arm/AstroAgentAssistant/tree/main/mlops/inference/guidance
Command: npx skills add https://github.com/arm2arm/AstroAgentAssistant --skill guidance-arm2arm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires guidance, transformers, and includes references (resource) components.

What problem does it solve?

Guidance enables control of LLM outputs by applying regex and grammars to ensure valid JSON/XML/code, enforce structured formats, and orchestrate multi-step workflows with constrained generation, improving reliability and safety.

Core Features & Use Cases

  • Constrained generation with regex and grammars to guarantee valid outputs, including JSON, XML, or code.
  • Grammar-based generation, token healing, and Pythonic workflow orchestration for multi-step tasks.
  • Local-model support (Transformers, llama.cpp) and diverse backends for fast, private experimentation and production deployment.

Quick Start

Install Guidance, configure a backend, and run a constrained-generation example.

Frequently Asked Questions about guidance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce structured JSON outputs from an LLM?

Constrained generation enforces structured JSON outputs by applying regex and grammars directly during LLM decoding. This guarantees valid formats for data extraction and API scaffolding without relying on post-processing validation.

What is grammar-based generation for large language models?

Grammar-based generation controls LLM decoding by enforcing strict syntax rules to produce deterministic outputs. It guarantees valid JSON, XML, or code by constraining the model to only generate tokens that match the defined grammar pattern.

Can I use constrained generation with local Transformers models?

Yes, constrained generation works with local Transformers models and llama.cpp backends. This allows fast, private experimentation and production deployment while maintaining strict output formatting and validation rules.

What is the best way to validate LLM outputs for API workflows?

The best way to validate LLM outputs for API workflows is grammar-based constrained generation. It enforces strict formats like JSON or XML during decoding, ensuring deterministic and safe structured automation without fragile post-generation parsing.

How do I orchestrate multi-step LLM workflows with strict formatting?

You orchestrate multi-step LLM workflows with strict formatting by using Pythonic workflow orchestration combined with constrained generation. This applies grammars and token healing across steps to guarantee valid outputs for complex document automation tasks.