--- id: marvin version: "3.2.7" 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) license_treatment: permissive maintenance: active --- # marvin — a simple and powerful tool to get things done with AI License: permissive · Maintenance: active · Downloads: 91.0K/mo ## 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 above — 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 pip install marvin uv add marvin poetry add marvin ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 91.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags structured output from llm, ai task orchestration framework, agentic workflow builder, extract classify generate with ai, type-safe llm results, multi-agent ai coordination, pydantic ai workflows, llm-framework, structured-output, agentic-ai [View on SkillFed](https://skillfed.io/packages/marvin) · [View on PyPI](https://pypi.org/project/marvin/)