AI functions and agentic workflow library by PrefectHQ. Provides decorator-based AI functions (marvin.fn, marvin.classify, marvin.extract, marvin.cast) and agent/task orchestration. v3.0 released 2024 — merged with ControlFlow, switched LLM backend from OpenAI-only to Pydantic AI (multi-provider). Current version: 3.2.7 (Mar 2026). WARNING: 'marvin' on PyPI is PrefectHQ's AI library — not the SDSS astronomy Marvin library (sdss-marvin on PyPI).
pip install marvinVerified import paths — ran on the pinned version, not inferred.
Core marvin 3.x structured output functions.
Set OPENAI_API_KEY env var. Or configure other providers via pydantic-ai settings.
Replace @flow decorated functions with 'with marvin.Thread(): marvin.run(...)' pattern.
Reset SQLite data after version updates during development. Production: handle migrations manually.
pip install marvin for AI functions. pip install sdss-marvin for astronomy. Never mix.
Set OPENAI_API_KEY or configure a different pydantic-ai provider explicitly.
Use @marvin.fn not @ai_fn.
Install build essentials and C/C++ libraries in your Alpine environment (e.g., 'apk add build-base libstdc++'). Alternatively, use a glibc-based Python image or ensure you're using a Rust toolchain specifically compiled for musl targets.