Instructor
AI AgentsInstructor is a Python library that makes LLM outputs conform to Pydantic schemas.
Instructor
What it is
Instructor is a Python library that makes LLM outputs conform to Pydantic schemas. You define a model, pass it to Instructor along with your prompt, and you get back a validated, typed Python object instead of raw text you have to regex or hope-parse. It wraps the OpenAI SDK (and now Anthropic, Cohere, Google, and others) with automatic retries on validation failure — if the LLM returns malformed JSON or violates your schema, Instructor feeds the error back to the model and asks it to fix it.
It's not an agent framework. It's a plumbing layer that sits between "LLM call" and "usable data structure." Category tag of "AI Agent" is a stretch — this is closer to a serialization/validation tool that agent frameworks lean on.
Who builds it and why
Built by Jason Liu, originally as a side project solving his own problem: getting structured JSON out of GPT models reliably before OpenAI's native function-calling and JSON mode matured. It grew because the problem it solves — "make the LLM give me a typed object, not a string" — is universal to basically every production LLM application. 251 contributors on GitHub indicates real community adoption beyond a single maintainer's pet project, though Jason Liu remains the primary figure associated with the project (conference talks, courses, consulting built around it).
No corporate backing, no foundation. This is an independent open-source project that became a de facto standard through usefulness rather than marketing spend.
Production readiness signal
- 13,352 GitHub stars — solid adoption signal for a focused utility library.
- 251 contributors — healthy bus factor, not a single-maintainer risk.
- Latest release v1.15.4 — mature version numbering suggests iterative, non-breaking evolution rather than a project still finding its API.
- Active commit history through mid-2026 — actively maintained, not abandoned.
- MIT license — no legal friction for commercial use.
- CNCF maturity: not publicly available — this isn't a CNCF project, so that framing doesn't apply here.
The library is widely used as a dependency inside larger LLM frameworks and internal tooling, which is a better production signal than star count alone: people are betting their pipelines on it, not just bookmarking it.
Who should use this
- Teams building LLM applications in Python who need reliable structured extraction (invoices, form data, classification labels, entity extraction) instead of parsing free text.
- Engineers who already use Pydantic and want schema validation, retries, and streaming support without hand-rolling JSON-mode error handling.
- Anyone building RAG pipelines, agents, or data extraction tools where the output needs to be typed and safe to pass into downstream code.
Who should NOT use this
- Non-Python shops. There's no first-class equivalent for Java, Go, or JS teams here — you're locked into the Python ecosystem.
- Teams already on native structured output APIs. OpenAI, Anthropic, and Google now offer native JSON schema / structured output modes. If you only use one provider and don't need Instructor's retry logic or multi-provider abstraction, you may be adding a dependency for marginal benefit.
- High-throughput, latency-sensitive systems where retry-on-validation-failure loops add unacceptable tail latency — you'll want to design stricter prompts and skip the retry layer.
- Teams needing agent orchestration, tool-calling graphs, or multi-step reasoning workflows. Instructor doesn't do that — pair it with LangGraph, CrewAI, or similar if that's your actual need.
Alternatives
- Native provider structured outputs (OpenAI's
response_format, Anthropic tool use) — no extra dependency, but less portable across providers and weaker validation ergonomics. - Marvin — similar Pydantic-based structured extraction, more opinionated toward AI-native "functions."
- Outlines — constrained decoding at the token level (works with local/open models), stronger guarantees than retry-based validation but more setup complexity.
Pricing
Fully open source, MIT licensed, free to use and modify. No paid tier, no hosted service. Cost exposure comes entirely from the underlying LLM API calls you make through it.