Marvin
An open-source Python framework for building AI applications with LLMs, featuring structured outputs, agentic workflows, multi-agent orchestration, and persistent memory.
At a Glance
Fully open-source under Apache License 2.0. Free to use, modify, and distribute.
Engagement
Available On
Listed Jun 2026
About Marvin
Marvin is an open-source Python framework maintained by PrefectHQ for building AI applications and agentic workflows with large language models. Released under the Apache License 2.0, it is freely available on GitHub and installable via PyPI. The project reached version 3.2.7 as of March 2026 and has accumulated over 6,000 stars on GitHub.
What It Is
Marvin sits in the AI development libraries category, providing Python developers with a clean, high-level API for working with LLMs. It handles the complexity of state management, conversation history, agent coordination, and structured output validation so developers can focus on application logic rather than LLM plumbing. The framework is built on top of Pydantic AI for LLM interactions, which means it natively supports the full range of LLM providers that Pydantic AI supports — not just OpenAI.
Core Abstractions
Marvin is organized around three primary building blocks:
- Tasks: The fundamental unit of work. Each task has clear instructions, a type-safe result type, optional tools, and observable execution. Tasks are composable and can depend on each other's outputs.
- Agents: Portable LLM configurations with specific instructions, personalities, model settings, and tools. Agents can be reused across tasks and combined into collaborative teams.
- Threads: Context managers that group tasks together, sharing conversation history and context across a multi-step workflow. Threads replace the
Flowconcept from the predecessor ControlFlow library.
Structured-Output Utilities
Beyond agentic workflows, Marvin exposes a set of high-level utility functions for common data transformation tasks:
marvin.extract— pull native Python types from unstructured textmarvin.cast— transform unstructured input into a typed structure (e.g., a TypedDict or Pydantic model)marvin.classify— categorize input against a predefined set of labels or an Enummarvin.generate— produce a list of structured objects from a descriptionmarvin.summarize— get a concise summary of a textmarvin.run— execute any task with an AI agent and optional result type
All utility functions have thread management built in, so they can be composed into chains that share context and history.
Update: Marvin 3.0 and the ControlFlow Merger
Marvin 3.0 was a significant architectural release that merged the developer experience of Marvin 2.x with the agentic engine of ControlFlow (a separate PrefectHQ project), effectively superseding ControlFlow. Key changes introduced in 3.0 include:
- Replaced Langchain (used by ControlFlow) and OpenAI-only support (Marvin 2.x) with Pydantic AI, enabling multi-provider LLM support
- Renamed ControlFlow's
FlowtoThread; removed the@flowdecorator - Moved thread and message history storage to SQLite
- Introduced
marvin.planfor breaking complex objectives into dependent tasks automatically
The latest release at time of writing is v3.2.7 (published March 4, 2026).
MCP and Ecosystem Integration
Marvin includes a dedicated guide for using MCP (Model Context Protocol) servers, allowing agents to connect to external tools and data sources via the MCP standard. The framework is designed to integrate with existing Python codebases and the broader AI ecosystem, including support for Anthropic, OpenAI, and any other provider accessible through Pydantic AI models.
Setup Path
Installation requires Python and a package manager. The recommended approach uses uv:
uv add marvin
An LLM provider API key (e.g., OPENAI_API_KEY) must be set as an environment variable. The framework defaults to OpenAI but accepts any Pydantic AI-compatible model configuration, including Anthropic's Claude models.
Community Discussions
Be the first to start a conversation about Marvin
Share your experience with Marvin, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully open-source under Apache License 2.0. Free to use, modify, and distribute.
- Full framework access
- Structured output utilities
- Multi-agent orchestration
- Thread management
- MCP server integration
Capabilities
Key Features
- Structured output extraction (extract, cast, classify, generate)
- Agentic task execution with marvin.run
- Multi-agent orchestration
- Persistent memory across conversations
- Thread management for multi-step workflows
- Type-safe results via Pydantic
- MCP server integration
- Support for multiple LLM providers via Pydantic AI
- Smart planning with marvin.plan
- Observable task execution with tool call logging
- CLI interactivity mode
- SQLite-backed conversation history
