Skip to content

■ PEOPLE // FIELD NOTE

Adam Azzam's ControlFlow Framework

How Prefect's VP of Product built ControlFlow and Marvin, bringing workflow orchestration and failure handling to AI agents with native observability

Adam Azzam's ControlFlow Framework
[!] OPERATOR DOSSIER
[!] ON THIS PAGE

Adam Azzam is VP of Product at Prefect , where he leads AI product development. He built ControlFlow and Marvin , two frameworks that bring workflow orchestration principles to LLM-powered applications. His core insight: AI agents need the same observability and failure handling that data pipelines do.

Background

  • PhD in Mathematics from UCLA (2012-2017)
  • Lead Data Scientist and Head of Product at Insight Data Science (YC S11)
  • Co-founded Openrole AI as CTO, building an AI career co-pilot
  • Joined Prefect in 2023 as AI Product Lead
  • GitHub: @aaazzam
  • LinkedIn

The Problem with Agentic Workflows

From Azzam’s Practical AI podcast appearance :

  • Developers spend ~5% of time on the happy path and ~90% handling failures
  • LLM workflows introduce dynamic execution paths you can’t pre-define
  • Agents create their own tasks, requiring orchestration of unknown workflows
  • Managing cascading errors (API failures, parsing issues, data quality) becomes overwhelming

Traditional AI frameworks treat agents as black boxes. ControlFlow treats them as observable units of work.

ControlFlow Architecture

ControlFlow breaks AI workflows into three components:

ComponentPurpose
TasksDiscrete, observable steps with typed outputs
AgentsLLM-powered entities assigned to tasks
FlowsContainers that orchestrate tasks and maintain context

Basic usage:

import controlflow as cf

result = cf.run("Write a short poem about artificial intelligence")
print(result)

Structured outputs with Pydantic:

import controlflow as cf
from pydantic import BaseModel

class ResearchProposal(BaseModel):
    title: str
    abstract: str
    key_points: list[str]

@cf.flow
def research_proposal_flow():
    user_input = cf.Task(
        "Work with the user to choose a research topic",
        interactive=True,
    )

    proposal = cf.run(
        "Generate a structured research proposal",
        result_type=ResearchProposal,
        depends_on=[user_input]
    )
    return proposal

Multi-Agent Coordination

ControlFlow supports three collaboration strategies:

StrategyBehavior
Round-robinAgents take turns in predefined order
RandomRandomly select next agent for unpredictability
ModeratedDesignated agent decides who acts next

Every ControlFlow flow is a Prefect flow, meaning you get:

  • Retries and caching out of the box
  • Transaction support for rollbacks
  • Full observability dashboard
  • Local development with .serve(), cloud deployment with .deploy()

The Marvin Framework

Before ControlFlow, Azzam led development of Marvin , which started as an internal Prefect tool in 2022. Nearly 3,000 developers deployed it to production within weeks of its March 2023 release.

Marvin’s approach: translate Python code to English prompts, send to LLM, parse responses back to typed Python objects.

import marvin

@marvin.fn
def sentiment(text: str) -> float:
    """Return sentiment score from -1 (negative) to 1 (positive)"""

score = sentiment("This product exceeded my expectations!")
# Returns: 0.85

Key Marvin features:

  • AI Models for structuring text into type-safe schemas
  • AI Classifiers using logit bias tricks for deterministic routing
  • Auto-generated prompts tailored to each LLM provider
  • Built-in concurrency, caching, and error handling

ControlFlow’s next-generation engine was integrated into Marvin 3.0, which now uses Pydantic AI and supports multiple LLM providers.

Key Takeaways

PrincipleImplementation
Tasks over promptsDefine discrete, observable units of work
Type-safe outputsUse Pydantic models for structured responses
Observability firstEvery flow integrates with Prefect dashboard
Explicit coordinationChoose agent collaboration strategy per task
Failure handlingInherit retries, caching, and transactions

Getting Started

pip install controlflow
export OPENAI_API_KEY="your-key"

For Marvin 3.0:

pip install marvin

Next: Jesse Vincent’s Superpowers Framework