marvin
a simple and powerful tool to get things done with AI
What it is and what it does
Marvin bridges the gap between unstructured AI outputs and type-safe Python code. At its core, it provides four structured-output utilities—extract, cast, classify, and generate—that let you pull native Python types and custom objects directly from LLM responses. Built on top of Pydantic for validation, it ensures results match your schema before they reach your code.
Beyond simple extraction, Marvin 3.x introduces a task-and-agent model for building agentic workflows. You define Tasks with clear instructions and result types, assign specialized Agents (which wrap LLM configurations), and optionally give tasks access to custom tools and context. Tasks can be composed into Threads for orchestrating complex multi-step behaviors. The framework is designed to make AI work observable and debuggable—you see which tools were called, what the agent did, and whether it succeeded.
Use it for:
- Extract structured data (prices, dates, entities) from unstructured text or documents without manual parsing.
- Classify user input into predefined categories (support tickets to departments, sentiment labels, etc.) with type-safe enum results.
- Build multi-step workflows where specialized agents collaborate—e.g., one agent researches, another writes, a third reviews.
- Generate synthetic test data or examples matching a specific schema for testing or prototyping.
- Delegate complex reasoning tasks to an LLM while keeping your application logic type-checked and deterministic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Marvin is a Python framework for building AI workflows that produce structured outputs and delegate tasks to language models. It provides utilities for extracting, casting, classifying, and generating data, plus a task-and-agent system for orchestrating multi-step agentic processes.
Yes, if you are building AI-powered applications and want structured, validated outputs without writing LLM response parsing code. Marvin's combination of simple extraction utilities and a composable task-agent framework makes it suitable for both quick prototyping and more complex agentic systems. Low install friction, active maintenance, permissive license, and no known vulnerabilities. Main constraint: requires an LLM API key and incurs per-call costs.
Install
marvin on PyPI
pip
pip install marvinuv
uv add marvinpoetry
poetry add marvinInstalling marvin
Before you install
Low install friction; pure Python wheel with no compiled dependencies. Actively maintained as of 163 days ago. Depends on a substantial but well-established stack: pydantic-ai, sqlalchemy, alembic, jinja2, typer, and rich—all mature libraries with good ecosystem standing.
License in practice
Apache License 2.0 (permissive). You may use, modify, and distribute Marvin and derivative works freely, including in commercial applications, provided you retain license notices and include a copy of the license with distributions.
Quickstart
import marvin
# Simple structured extraction
result = marvin.extract(
"i found $30 on the ground and bought 5 bagels for $10",
int,
instructions="only USD"
)
print(result) # [30, 10]
# Or run a task
poem = marvin.run("Write a short poem about artificial intelligence")
print(poem)
Requires Python >=3.10. Requires an LLM provider API key (OpenAI by default; set OPENAI_API_KEY environment variable, or configure an alternative via pydantic-ai).
Verify before relying
- Whether all Pydantic AI models are truly natively supported or if some require additional configuration beyond what the fact sheet shows.
- Performance characteristics and latency for complex multi-agent workflows or large-scale task orchestration.
- Specific error handling and retry behavior when LLM calls fail or time out.
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 10 — aiosqlite, alembic, jinja2, partial-json-parser, pydantic-ai, pydantic-settings, pydantic, rich, sqlalchemy, typer |
| Maintenance | actively maintained — 163 days since the last release |
| First released | |
| Downloads | 91,045/month — #13,547 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: marvin-3.2.7-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
agent-framework-coreBuild, orchestrate, and deploy AI agents and…
permissive · top 5,000 on PyPI
pydantic-aiPydantic AI is a Python framework for building…
permissive · top 5,000 on PyPI
semantic-kernelSemantic Kernel is a Python SDK for building AI…
permissive · top 5,000 on PyPI
pydantic-deepA Python framework and terminal assistant for…
permissive · top 15,000 on PyPI
agent-frameworkBuilds and orchestrates AI agents powered by…
permissive · top 5,000 on PyPI
agent-framework-claudeIntegrates Claude with Microsoft Agent…
permissive · top 15,000 on PyPI
strands-agents-builderStrands Agent Builder is a terminal-based…
permissive · top 15,000 on PyPI
autogenA framework for building AI agents that…
permissive · top 15,000 on PyPI
langchain-cliCommand-line interface for building, testing,…
permissive · top 15,000 on PyPI