Prefect Logo
AI

Introducing ControlFlow

A new Python framework for building agentic workflows, powered by Prefect 3.0

June 25, 2024
Adam Azzam, PhD
Principal PM

AI is revolutionizing software development, but orchestrating complex, multi-agent workflows remains a formidable challenge. Today, we're introducing ControlFlow, an open-source tool that streamlines AI workflow management without compromising on flexibility or control.

ControlFlow isn't another abstraction layer – it's a practical solution born from real-world challenges in deploying AI at scale. Key aspects include:

  • Granular control over agent interactions
  • Advanced observability for efficient debugging and optimization
  • Seamless integration with existing tools and ML frameworks
  • Built on battle-tested orchestration principles

As developers who've grappled with these issues firsthand, we've created a tool we genuinely want to use. ControlFlow complements your existing stack, offering a pragmatic approach to taming the complexity of multi-agent systems.

Agentic Workflows

In the last two years, Large Language Models (LLMs) have become essential for tasks like classification, data extraction, and summarization. But their capabilities go beyond simply answering questions - they're also good at figuring out what questions to ask in the first place.

This ability to create and refine plans, choose tools, and execute tasks blurs the line between following instructions and managing workflows. When given clear, scoped tasks, LLMs perform reliably. But they really shine when also given broader objectives.

With the right context, LLMs can take a high-level goal and break it down into steps, choosing appropriate tools along the way. This enables dynamic workflows that adapt to the problem at hand, far more flexible than traditional static processes.

Our work over the past year has shown that letting LLMs create their own instructions, plans, and toolsets leads to significant performance improvements compared to zero-shot approaches. This self-direction opens up new possibilities for automated problem-solving and task completion.

However, handing over control to LLMs for complex processes isn't straightforward. It introduces challenges in three key areas:

  1. Orchestration: Managing multiple AI agents—each potentially creating new tasks—gets complicated quickly.
  2. Observability: Tracking decision-making across these fluid workflows is tough.
  3. Control and trust: Ensuring AI agents stay within bounds and produce consistent results becomes crucial as they gain more autonomy.

These issues make it hard to guide, control, and trust the outcomes of AI-driven workflows. As we push further in this direction, we need new tools to handle the increased complexity while maintaining visibility and control.

Enter ControlFlow

The potential of agentic workflows is huge, but acheiving it means solving these new challenges: we’re building ControlFlow to do just that. It's an open-source tool that simplifies the orchestration, monitoring, and deployment of AI agents. At its core, ControlFlow manages the interplay between flows (your overall processes), tasks (individual steps), and agents (the AI entities doing the work).

We didn't start from scratch. ControlFlow is built on Prefect, an open-source workflow engine that's proven its mettle in handling complex, dynamic processes. Prefect gives us a solid foundation for scheduling and execution, allowing us to focus on the unique challenges of AI workflows.

Through our work on ControlFlow, we've learned a lot about wrangling AI agents:

  • Flexibility is key. AI workflows aren't static - they need to adapt on the fly based on intermediate results. We've built in the ability to dynamically adjust paths and spawn new tasks as needed.
  • Visibility is crucial. When things go sideways (and they will), you need to know what happened. We've put a lot of effort into making the decision-making processes of AI agents transparent and debuggable.
  • Control is non-negotiable. As powerful as these AI agents are, you need to be able to step in and course-correct. ControlFlow gives you the hooks to intervene at critical points in the process.

Looking ahead

We're focusing on a few key areas:

  1. We're working on making it easier to evaluate AI workflows. This isn't just about inputs and outputs - we're looking at the entire path an agent takes to reach a solution. This approach will give you deeper insights into your AI's decision-making process.
  2. We're also developing ways to set guardrails for your AI agents. Think of it as defining the playground within which your AI can operate freely, while ensuring it doesn't wander into unsafe territory.

ControlFlow is a work in progress, and we're excited to build it in the open. We believe that the challenges of AI orchestration are best solved collaboratively. Whether you're running complex AI workflows in production or just starting to experiment with multi-agent systems, we'd love for you to try out ControlFlow and contribute to its development. Let's shape the future of AI workflow management together.

Learn More