mirror of
https://github.com/magnus919/agent-skills.git
synced 2026-09-11 19:47:12 +03:00
DSPy v1.1.0: validation audit, worked RAG compilation example, expand ref table Haystack v1.1.0: validation audit, file converters/YAML/component types, +2 refs CrewAI v1.1.0: validation audit, unified Memory system, Flows docs, +3 refs AutoGen v1.1.0: validation audit, v0.4 migration guide, AgentTool, streaming, +2 refs All API surfaces validated against official docs.
1.6 KiB
1.6 KiB
CrewAI Flows — Event-Driven Orchestration
Flows connect multiple Crews into event-driven workflows with state management, resumption, and conditional branching.
Basic Flow
from crewai.flow.flow import Flow, listen, start
class MyFlow(Flow):
@start()
def begin(self):
print("Flow started")
return {"data": "initial"}
@listen(begin)
def process_data(self, state):
print(f"Processing: {state['data']}")
# Launch a crew here
return {"result": "processed"}
flow = MyFlow()
result = flow.kickoff()
State Management with @persist
from crewai.flow.flow import Flow, listen, start, persist
@persist # State persists across executions
class PersistentFlow(Flow):
counter: int = 0 # Tracked state
@start()
def increment(self):
self.counter += 1
return {"counter": self.counter}
Connecting Multiple Crews
class ResearchFlow(Flow):
@start()
def research(self):
crew = Crew(agents=[researcher], tasks=[research_task], process=Process.sequential)
return crew.kickoff()
@listen(research)
def write_report(self, state):
crew = Crew(agents=[writer], tasks=[write_task], process=Process.sequential)
return crew.kickoff()
Key Features
- Event-driven:
@listendecorator triggers on completion of upstream steps - State management:
@persistenables state to survive across executions - Restoration:
restore_from_state_idto resume flows from checkpoints - Multiple crews: Connect separate crews into a single orchestrated workflow