Adam Azzam's ControlFlow Framework

Table of content
Adam Azzam's ControlFlow Framework

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

The Problem with Agentic Workflows

From Azzam’s Practical AI podcast appearance:

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:

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:

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

Topics: ai-agents workflow-orchestration llm python open-source