ControlFlow
v0.11.3: Exception-al Service

ControlFlow는 에이전트 AI 워크 플로를 구축하기위한 파이썬 프레임 워크입니다.
ControlFlow는 제어 나 투명성을 희생하지 않고 워크 플로를 정의하고 LLM에 작업 위임을위한 구조화 된 개발자 중심의 프레임 워크를 제공합니다.
가장 간단한 ControlFlow 워크 플로에는 하나의 작업, 기본 에이전트 및 자동 스레드 관리가 있습니다.
import controlflow as cf
result = cf . run ( "Write a short poem about artificial intelligence" )
print ( 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는 강력하고 예측 가능한 AI 기반 애플리케이션을 구축하는 문제를 해결합니다.
pip 로 ControlFlow를 설치하십시오.
pip install controlflow 다음으로 LLM 제공 업체를 구성하십시오. ControlFlow의 기본 공급자는 OpenAI이며 OPENAI_API_KEY 환경 변수가 필요합니다.
export OPENAI_API_KEY=your-api-key
다른 LLM 제공 업체를 사용하려면 LLM 구성 문서를 참조하십시오.
다음은 사용자 상호 작용, 다단계 워크 플로 및 구조화 된 출력을 보여주는보다 관련된 예입니다.
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 ():
# Task 1: Get the research topic from the user
user_input = cf . Task (
"Work with the user to choose a research topic" ,
interactive = True ,
)
# Task 2: Generate a structured research proposal
proposal = cf . run (
"Generate a structured research proposal" ,
result_type = ResearchProposal ,
depends_on = [ user_input ]
)
return proposal
result = research_proposal_flow ()
print ( result . model_dump_json ( indent = 2 ))대화:
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 workflows제안:
{ "title" : " AI Agentic Workflows: Enhancing Efficiency and Automation " , "abstract" : " This research proposal aims to explore the development and implementation of AI agentic workflows to enhance efficiency and automation in various domains. AI agents, equipped with advanced capabilities, can perform complex tasks, make decisions, and interact with other agents or humans to achieve specific goals. This research will investigate the underlying technologies, methodologies, and applications of AI agentic workflows, evaluate their effectiveness, and propose improvements to optimize their performance. " , "key_points" : [ " Introduction: Definition and significance of AI agentic workflows, Historical context and evolution of AI in workflows " , " Technological Foundations: AI technologies enabling agentic workflows (e.g., machine learning, natural language processing), Software and hardware requirements for implementing AI workflows " , " Methodologies: Design principles for creating effective AI agents, Workflow orchestration and management techniques, Interaction protocols between AI agents and human operators " , " Applications: Case studies of AI agentic workflows in various industries (e.g., healthcare, finance, manufacturing), Benefits and challenges observed in real-world implementations " , " Evaluation and Metrics: Criteria for assessing the performance of AI agentic workflows, Metrics for measuring efficiency, accuracy, and user satisfaction " , " Proposed Improvements: Innovations to enhance the capabilities of AI agents, Strategies for addressing limitations and overcoming challenges " , " Conclusion: Summary of key findings, Future research directions and potential impact on industry and society " ] }
이 예에서 ControlFlow는 일련의 작업에 대한 flow 또는 공유 컨텍스트를 자동으로 관리합니다. 표준 파이썬 기능과 에이전트 작업을 언제든지 전환하여 복잡한 워크 플로우를 쉽게 구축 할 수 있습니다.
ControlFlow에 더 깊이 뛰어 들기 위해 :