Full-Code · Orchestration Frameworksactive

Marvin

also known as ControlFlow (predecessor)

Type: full-code  ·  Vendor: Prefect Technologies  ·  Language: Python  ·  License: Apache-2.0  ·  Status: active  ·  Status in practice: emerging

Links: homepage repo

Express agentic AI work as a set of structured Tasks executed by portable Agents inside Threads, producing validated Pydantic outputs.

Description. Marvin is PrefectHQ's Python framework for structured AI outputs and task-based agentic workflows. Marvin 3.x merged the developer ergonomics of Marvin 2.x with the agentic engine of ControlFlow (and supersedes ControlFlow). The core abstractions are Task (a structured unit of work with a result type), Agent (a portable LLM configuration assigned to tasks), and Thread (a conversation context that maintains history and shared state across tasks). Internally Marvin uses Pydantic AI for LLM interactions and supports the LLM providers Pydantic AI supports. Threads persist in SQLite; structured outputs are validated against Pydantic types.

Agent loop shape. Task-centric agentic loop. Each Task names a result type, an agent, and optional tools; the agent runs Pydantic AI under the hood, calling tools until the result conforms to the declared type. Threads compose Tasks into customizable chains that share history; thread state is persisted to SQLite so a thread can be resumed by id.

Primary use cases

  • extracting and validating structured data from unstructured text
  • composing AI workflows from typed Tasks
  • sequencing tool-using agents within a Thread
  • casting/classifying/summarising with Pydantic-validated returns

Key concepts

  • Task structured-output (docs)Structured unit of work with a declared result type, assigned tools, and an assigned Agent; the result is validated before return.
  • Agent (docs)Portable LLM configuration (model, instructions, tools) that can be assigned to one or more tasks.
  • Thread session-isolation (docs)Conversation context that spans tasks; persisted to SQLite so it can be resumed by id.
  • Pydantic AI backbone (docs)Marvin 3 uses Pydantic AI for LLM interactions and inherits its provider matrix.

Patterns this full-code implements

Neighbourhood

Click any neighbour to follow the lineage. Scroll to zoom, drag to pan.