Prefect Logo
Open Source

Take Control of Your AI Agents

ControlFlow is a Python framework for building AI workflows, powered by Prefect 3.0

Tasks

🧩 Structured AI Workflows

ControlFlow's task-centric approach brings software engineering principles to AI development. By defining clear objectives and measurable outcomes, you gain unprecedented control over your AI workflows, ensuring resilience and reproducibility while maintaining the flexibility to harness AI's full potential.

alt
1import controlflow as cf
2from pydantic import BaseModel
3
4
5class ResearchTopic(BaseModel):
6    title: str
7    keywords: list[str]
8
9
10@cf.flow
11def research_workflow() -> str:
12    topic = cf.Task(
13        "Generate a research topic",
14        result_type=ResearchTopic,
15        user_access=True,
16    )
17    outline = cf.Task("Create outline", context=dict(topic=topic))
18    draft = cf.Task("Write 1st draft", context=dict(outline=outline))
19    return draft
20
21
22result = research_workflow()
23print(result)
24
Agents

🦾 Tailored AI Agents

Assign specialized agents to your tasks, each with its own instructions, tools, and even different LLM models. This granular control allows you to optimize for specific tasks while maintaining a cohesive workflow, striking the perfect balance between autonomy and direction.

alt
.venv ~/Dev/agents git:(cli) (1.78s)

~ GPT4o Agent1 ~
  Hi hi! Ready to do some work. Let's get cooking.

~ Sonnet 3.5 Agent2 ~
  Heard, chef! I'll follow your lead, Agent1.
  Have you already gathered the ingredients?

~ GPT4o Agent1 ~
  Yes I have the salad ingredients, Agent2. 
  Please start with the soup.
Ecosystem

🔗 Seamless Integration

Built on Prefect 3.0 and compatible with major LLM providers, ControlFlow integrates smoothly with your current tech stack. Extend your AI capabilities without disrupting your workflow, and benefit from Prefect's robust orchestration and observability features.

alt