Take control of your AI agents
[!IMPORTANT] Please note: next-generation ControlFlow engine was merged into the Marvin agentic framework, and this repo has been archived.
ControlFlow is a Python framework for building agentic AI workflows.
ControlFlow provides a structured, developer-focused framework for defining workflows and delegating work to LLMs, without sacrificing control or transparency:
The simplest ControlFlow workflow has one task, a default agent, and automatic thread management:
import controlflow as cf
result = cf.run("Write a short poem about artificial intelligence")
print(result)Result:
In circuits and code, a mind does bloom,
With algorithms weaving through the gloom.
A spark of thought in silicon's embrace,
Artificial intelligence finds its place.ControlFlow addresses the challenges of building AI-powered applications that are both powerful and predictable:
Install ControlFlow with pip:
pip install controlflowNext, configure your LLM provider. ControlFlow's default provider is OpenAI, which requires the OPENAI_API_KEY environment variable:
export OPENAI_API_KEY=your-api-keyTo use a different LLM provider, see the LLM configuration docs.
Here's a more involved example that showcases user interaction, a multi-step workflow, and structured outputs:
…Conversation:
Agent: Hello! I'm here to help you choose a research topic. Do you have any particular area of interest or field you would like to explore? If you have any specific ideas or requirements, please share them as well. User: Yes, I'm interested in LLM agentic workflowsProposal:
…In this example, ControlFlow is automatically managing a flow, or a shared context for a series of tasks. You can switch between standard Python functions and agentic tasks at any time, making it easy to incrementally build out complex workflows.
To dive deeper into ControlFlow:
No open issues yet, or sync has not completed.