Adam Azzam's ControlFlow Framework
Table of content

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
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:
| Component | Purpose |
|---|---|
| Tasks | Discrete, observable steps with typed outputs |
| Agents | LLM-powered entities assigned to tasks |
| Flows | Containers 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:
| Strategy | Behavior |
|---|---|
| Round-robin | Agents take turns in predefined order |
| Random | Randomly select next agent for unpredictability |
| Moderated | Designated 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
| Principle | Implementation |
|---|---|
| Tasks over prompts | Define discrete, observable units of work |
| Type-safe outputs | Use Pydantic models for structured responses |
| Observability first | Every flow integrates with Prefect dashboard |
| Explicit coordination | Choose agent collaboration strategy per task |
| Failure handling | Inherit retries, caching, and transactions |
Getting Started
pip install controlflow
export OPENAI_API_KEY="your-key"
For Marvin 3.0:
pip install marvin
Links
- ControlFlow GitHub
- Marvin GitHub
- ControlFlow Documentation
- Introducing ControlFlow
- Marvin 1.4 Release Notes
- Practical AI Podcast
Next: Jesse Vincent’s Superpowers Framework
Get updates
New guides, workflows, and AI patterns. No spam.
Thank you! You're on the list.