IBM's AI development studio for building generative AI apps and agents with foundation models, prompt tools, and machine learning, billed by usage.

Instructor
Open-source library that gets validated, typed structured data out of LLMs using Pydantic models and automatic retries.
What is Instructor?
Instructor is an open-source library for pulling structured data out of large language models. In Python you describe the result you want as a Pydantic model, pass it as a response_model, and Instructor converts it to a schema the model understands, checks the reply against your rules and retries with the error when validation fails. A single from_provider call creates a client for OpenAI, Anthropic, Google, Mistral, Cohere, Ollama, DeepSeek and more than 15 other providers, so switching models does not change your extraction code. It supports streaming of partial objects and lists, nested schemas, custom validators, hooks, caching and token-usage tracking. Ports exist for TypeScript, Go, Ruby, Elixir and Rust. The project says Instructor is meant for quick schema-first extraction and points to PydanticAI when you need agents with tools and dashboards. Instructor itself has no pricing plans, since you only pay your model provider.
Use cases
- Extract structured data from text
- Validate LLM responses against a schema
- Classify content with typed outputs
- Parse documents and PDFs into models
- Stream partial structured results
- Switch LLM providers without code changes
Who it's for
Why use Instructor
- Typed results cut the amount of hand-written JSON parsing and error handling in your code.
- Validation plus retries catches malformed model answers before they reach the rest of your application.
- A shared interface across providers makes it simple to compare or swap models.
- Familiar Pydantic syntax means little new to learn for Python teams.
Instructor features
- Pydantic response models for structured output
- Automatic retries when validation fails
- Custom validators and Pydantic field rules
- Streaming of partial objects and iterable lists
- One from_provider interface for 15+ providers
- Local models through Ollama, llama-cpp-python or vLLM
- Multimodal input including audio, images and PDFs
- Hooks for monitoring and debugging
- Response caching and token usage tracking
- FastAPI integration
- Access to the raw LLM completion
Instructor integrations
How to get started with Instructor
- Install Instructor with pip, uv or poetry, adding the extra for your provider if needed.
- Define a Pydantic model describing the fields you want back.
- Create a client with from_provider, for example for OpenAI, Anthropic or a local Ollama model.
- Call create with your messages and the response model.
- Use the validated, typed object, or stream partial results as they arrive.
Instructor limitations
- It is a code library, so using it requires programming
- You pay your LLM provider for model calls separately
- Each provider supports different modes and capabilities
- For agents with quality gates and dashboards the docs point to PydanticAI
Instructor pricing
Instructor is open source, so you can use and self-host it for free.
Prices can change and may vary by country or exclude tax. Check the official pricing page.
Instructor alternatives
The main Instructor alternatives listed on Debuly are Pydantic AI, LangChain, Outlines, Marvin, Guidance and BAML. The table compares pricing and platforms; order is A–Z.
| Tool | Pricing | Starting price | Platforms |
|---|---|---|---|
| Instructor | Open source | — | API, Self-hosted |
| BAML | Open source | — | CLI, macOS, Linux, Windows |
| Guidance | Open source | — | API |
| LangChain | Freemium | $39/mo | Web, API, Self-hosted |
| Marvin | Open source | — | Python, CLI |
| Outlines | Open source | — | API |
| Pydantic AI | Open source | — | API, CLI, Self-hosted |

BAML
Open-source, TypeScript-like programming language for agents, with typed LLM functions, built-in tests and SDK generation.
Open sourceVisit BAML (official site)
Guidance
Python library for steering language models, combining constrained generation with ordinary control flow so outputs follow regexes, grammars or JSON schemas.
Open sourceVisit Guidance (official site)
LangChain
Open-source framework for building LLM agents, paired with LangSmith for tracing, evals and agent deployment.
FreemiumVisit LangChain (official site)
Marvin
Open source Python framework from Prefect for getting structured output from LLMs and building agent workflows from tasks and threads.
Open sourceVisit Marvin (official site)
Outlines
Python library from .txt that makes LLM output match a type you define, such as a Pydantic model, enum or regex, during generation.
Open sourceVisit Outlines (official site)
Pydantic AI
A type-safe, model-agnostic Python framework for building agents and LLM applications, from the team behind Pydantic.
Open sourceVisit Pydantic AI (official site)
Instructor FAQ
Is Instructor free?
The library is open source and has no published pricing plans. You still pay for the model API, hosting or compute that you connect it to.
How does Instructor work?
It adds a response_model parameter to the client, turns your Pydantic model into a schema, validates the LLM reply, retries automatically on failure and returns a typed object.
Which LLM providers does Instructor support?
More than 15 providers, including OpenAI, Anthropic, Google, Mistral, Cohere, Groq and Ollama for local models. LiteLLM and OpenRouter act as routing options.
Which programming languages does Instructor support?
The documentation lists Python, TypeScript, Go, Ruby, Elixir and Rust.
Does Instructor support streaming?
Yes. It can stream partially completed objects with create_partial and collections of completed objects through its iterable streaming.
What are alternatives to Instructor?
Alternatives include PydanticAI, LangChain, Outlines and Marvin, depending on how much of the agent loop you want to control.
Sources & verification
Facts on this page come from the official sources below, each with the date we read it. Written by Debuly; the vendor did not review this page.
| Source | Type | Accessed |
|---|---|---|
| python.useinstructor.com/ | official | |
| github.com/567-labs/instructor | repository | |
| python.useinstructor.com/faq/ | official | |
| python.useinstructor.com/concepts/ | official | |
| python.useinstructor.com/integrations/ | official |
Image credits
- Logo: from python.useinstructor.com · fetched · Vendor trademark, used only to identify the product; removed on request
- Cover: none collected yet, so a generated tile is shown.
Spot an error? Report an issue with this listing. We also remove a logo or image on the owner's request.




