Skip to content

Menu

Instructor logo

Instructor

Published

At a glance

What it is
Instructor is a popular open-source library for getting reliable structured data out of language models.
Price from
Open source Details
Best for
Extracting structured data from text, documents or emails; Python developers already using Pydantic
Last checked
November 2026
Watch out for
It focuses on structured output, not full agents; use an agent framework for those.

Instructor is a popular open-source library for getting reliable structured data out of language models. You define the shape you want as a Pydantic model, for example a User with a name and an age, and Instructor makes the model return data that fits it, validating the result and retrying automatically if it does not. It removes the need to write JSON schemas by hand, parse tool-call arguments or write your own validation and retry logic.

The library works with every major provider through one interface: you create a client with a provider string such as OpenAI, Anthropic, Google, Groq or a local Ollama model, and the same code works across them. Beyond simple extraction, it handles nested objects and lists, streams partial objects while they are being generated, which is useful for showing results as they arrive, and feeds validation errors back to the model when it retries, so the second attempt is usually correct. Because validation uses Pydantic, you can add your own rules, such as checking that a value is in range.

Instructor is MIT-licensed, with about 14,000 stars on GitHub, and its README reports more than 3 million monthly downloads. There are also implementations for TypeScript, Ruby, Go, Elixir and Rust. The project itself gives sensible advice on when to use it: Instructor is best for fast, schema-first extraction, while PydanticAI, the Pydantic team's agent framework, is the better fit when you need full agents with tools, observability and evaluations. Many teams use both.

Key features

Pydantic models as output
Define the structure you want and get validated, typed objects back.
Automatic retries
Failed validations are retried with the error message sent to the model.
Any provider
OpenAI, Anthropic, Google, Groq, Ollama and more through one interface.
Streaming partial objects
Receive partially filled objects as the model generates them.
Nested structures
Extract complex nested objects and lists.
Other languages
TypeScript, Ruby, Go, Elixir and Rust implementations.

Pricing

As of November 2026, Instructor is free and open source under the MIT licence. You pay only the model provider for the tokens your requests use; automatic retries can add extra calls when validation fails, so set a sensible retry limit.

Best for

  • Extracting structured data from text, documents or emails
  • Python developers already using Pydantic
  • Apps that must work across several model providers
  • Teams that want validation and retries without writing them

Limitations

  • It focuses on structured output, not full agents; use an agent framework for those.
  • Retries add cost and latency when models struggle with a schema.
  • Many providers now offer native structured output, which covers simple cases.
  • Very large or complex schemas can still produce unreliable results.

Verdict

Instructor is the simplest reliable way to get structured data from language models in Python, and its multi-provider support makes it future-proof. Use it for extraction and classification tasks. For full agents, pair it with or move to PydanticAI.

Sources

Written from the vendor's own site and documentation, checked November 2026. We have no paid relationship that affects what this page says.

How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…