Marvin
Prefect's open-source Python library for structured LLM outputs, typed tasks, agents and threads, built on Pydantic AI
Overview
Marvin is an open-source Python library from Prefect for "structured data and tasks for Python applications." Small functions turn messy text into typed Python values: cast converts input to a type, extract pulls lists of entities, classify picks labels and generate creates examples, each with an async twin. For bigger jobs, marvin.run runs typed tasks with tools, Agents bundle reusable instructions and tools, and Threads keep shared conversation history in a database. Marvin 3.0 (February 2025) merged Marvin with Prefect's ControlFlow agent library and rebuilt both on Pydantic AI, which now handles model access and output validation. The project first shipped on PyPI in March 2023 and is still active: v3.2.10 came out on October 27, 2026. Also from Prefect: Prefect and FastMCP.
The Verdict
Who Should Use Marvin?
Best For
- Python developers who want typed LLM outputs with a few lines of code
- Quick extraction, classification and casting inside existing apps
- Former ControlFlow users moving to a maintained library
Not Ideal For
- Teams outside Python
- Large multi-agent systems that need a full agent platform
- Buyers who want vendor support or an SLA (community project)
What's Great
- Very small API: cast, extract, classify, generate and run
- Pydantic AI underneath, so outputs are validated against your types
- Free, Apache-2.0 and backed by Prefect, with releases through Oct 2026
Watch Out For
- Version 3.0 had breaking changes; older Marvin 2 code needs migration
- Moving from ControlFlow is easy unless you rely on Prefect instrumentation
- Outputs can still be wrong: a correct type does not mean correct content (docs note)
Pricing
View all features & details
Key Features
- cast, extract, classify, generate and summarize functions, sync and async
- marvin.run for typed tasks with tools
- Agents with reusable instructions and tools
- Threads with shared history (Postgres or in-memory store)
- Planning and a JSON Schema parser (added in 3.0)
- Model access through Pydantic AI; OpenAI is the default
Project
- Maintained by Prefect (PrefectHQ on GitHub)
- First PyPI release March 2023; 1.0 July 2023; 3.0 February 2025
- Python 3.10 or newer
Real-World Usage
Release Activity
- 3.1 (May 2025) and 3.2 (Aug 2025) followed the 3.0 merge
- Patch releases in Jan, Mar and Oct 2026
- 3.2.9 lifted the Pydantic AI and Anthropic version caps
Community
- Support runs through the Prefect community and GitHub issues
- ControlFlow users were pointed to Marvin 3 after the merge
How It Compares
| Feature | Marvin | Instructor | Pydantic AI |
|---|---|---|---|
| Main job | One-call typed functions plus tasks and agents | Structured outputs from LLM calls | General agent framework |
| Built on | Pydantic AI | Provider SDKs and Pydantic | Pydantic |
| Agents and threads | Yes | No | Yes |
| License | Apache-2.0 | Open source | Open source |
Sources: Marvin docs · GitHub · Marvin 3.0 release · Releases
Is this your tool? Add a badge