mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 23:32:39 +00:00
Almost working!
This commit is contained in:
28
src/crewai/flow/unstructured_test_flow.py
Normal file
28
src/crewai/flow/unstructured_test_flow.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from crewai.flow.flow import Flow, listen, start
|
||||
|
||||
|
||||
class FlexibleExampleFlow(Flow):
|
||||
@start()
|
||||
def start_method(self):
|
||||
print("Starting the flexible flow")
|
||||
self.state.counter = 1
|
||||
return "Start result"
|
||||
|
||||
@listen(start_method)
|
||||
def second_method(self, result):
|
||||
print(f"Second method, received: {result}")
|
||||
self.state.counter += 1
|
||||
self.state.message = "Hello from flexible flow"
|
||||
return "Second result"
|
||||
|
||||
@listen(second_method)
|
||||
def third_method(self, result):
|
||||
print(f"Third method, received: {result}")
|
||||
print(f"Final counter value: {self.state.counter}")
|
||||
print(f"Final message: {self.state.message}")
|
||||
return "Third result"
|
||||
|
||||
|
||||
# Run the flows
|
||||
flexible_flow = FlexibleExampleFlow()
|
||||
flexible_flow.run()
|
||||
Reference in New Issue
Block a user