Marvin

Marvin

★ 4 🔖 2500 saves 💰 Free GitHub

Marvin is a Python framework from the Prefect team for producing structured outputs and building agentic AI workflows. Instead of wrestling raw text out of a language model, you describe the shape of the answer you want and Marvin coerces, classifies or extracts it for you. The project has about 6,200 stars on GitHub, is released under the Apache 2.0 license, and was actively developed in 2026.

Overview

Marvin is organized around three building blocks: tasks that describe an objective, specialized agents that carry tasks out, and threads that orchestrate multi-step behavior with observable state. On top of that sit the structured-output utilities the library is best known for — cast, classify, extract and generate — which turn unstructured text into typed Python objects such as enums, dictionaries and Pydantic models. Marvin runs on Pydantic AI under the hood, so although OpenAI models are the default, the models of every major provider can be plugged in with the same API.

Marvin began life as a set of AI utilities inside the Prefect ecosystem and has grown into a standalone framework in its 3.x line. Because it leans on Pydantic for validation, malformed model outputs are caught and retried against the schema instead of leaking downstream as bad data — the property that makes its cast and classify functions safe to use in production pipelines, data-processing jobs and evaluation harnesses where the shape of the answer matters as much as the answer itself.

Key Features

  • Structured-output utilities: cast, classify, extract and generate typed data from any input
  • Task-based workflow model with discrete, observable units of work
  • Specialized AI agents that can be assigned to tasks and combined in threads
  • Built on Pydantic AI, with native support for OpenAI, Anthropic, Gemini and other models
  • Full type safety: results come back as native Python types and Pydantic models
  • Simple installation from PyPI and a small, readable API surface

💳 Pricing

Free. Marvin is open source under the Apache 2.0 license; you only pay for the LLM API usage of whichever provider you configure.

Who Is It For

Python developers who want reliable, typed outputs from LLMs and a lightweight way to compose agent workflows without adopting a heavy orchestration framework.

🚀 Visit Marvin Official Site

🚩 Report an issue