Instructor

Patches LLM clients (OpenAI, Anthropic, Gemini, Cohere, etc.) to return validated Pydantic model instances instead of raw text, with automatic retry on validation failure.

Evaluated Mar 06, 2026 (0d ago) v1.x
Homepage ↗ Repo ↗ AI & Machine Learning python llm structured-output pydantic openai anthropic
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
29
/ 100
Is it safe for agents?
⚡ Reliability
58
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
0
Auth Strength
0
Scope Granularity
0
Dep. Hygiene
80
Secret Handling
85

No network surface; secrets are passed to underlying provider SDKs. Dependency chain includes openai, anthropic, and pydantic — review transitive deps for supply-chain risk.

⚡ Reliability

Uptime/SLA
0
Version Stability
78
Breaking Changes
70
Error Recovery
83
AF Security Reliability

Best When

You already use OpenAI/Anthropic SDKs and need Pydantic-validated structured outputs with minimal boilerplate and automatic retry logic.

Avoid When

You need guaranteed schema adherence without any LLM retry budget, or when operating at token-level generation constraints.

Use Cases

  • Extracting structured data (entities, dates, relations) from unstructured text with guaranteed schema compliance
  • Building agent pipelines that require typed, validated outputs at each reasoning step
  • Classifying inputs into enum-typed categories with LLM-backed confidence
  • Parsing LLM tool-call responses into strongly-typed Python dataclasses for downstream processing
  • Streaming partial structured responses for real-time UI updates while maintaining type safety

Not For

  • Applications requiring token-level constraint enforcement (use Outlines instead)
  • Non-Python environments or teams wanting a REST API rather than a library
  • Scenarios where LLM provider function-calling / tool-use is unavailable or unsupported

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Library — auth via underlying LLM provider credentials (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.).

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Open source MIT. LLM provider API costs apply separately.

Agent Metadata

Pagination
none
Idempotent
Partial
Retry Guidance
Documented

Known Gotchas

  • max_retries default is 1 — agents that need guaranteed output must explicitly set higher values or handle InstructorRetryException
  • Streaming partial models via Iterable[Model] returns incomplete instances mid-stream; agents must not act on partial data
  • Provider-patching is mutable global state — patching the same client twice with different modes silently overwrites the first patch
  • Anthropic and Gemini backends use slightly different function-calling schemas; switching providers may require Pydantic model adjustments
  • Large Pydantic models with many optional fields can exhaust token budgets on repeated retry attempts — set strict field counts

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Instructor.

$99

Scores are editorial opinions as of 2026-03-06.

5173
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered