forked from i-am-bee/beeai-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.py
More file actions
29 lines (21 loc) · 723 Bytes
/
simple.py
File metadata and controls
29 lines (21 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import asyncio
import sys
import traceback
from pydantic import BaseModel
from beeai_framework.errors import FrameworkError
from beeai_framework.workflows import Workflow
async def main() -> None:
# State
class State(BaseModel):
input: str
workflow = Workflow(State)
workflow.add_step("first", lambda state: print("Running first step!"))
workflow.add_step("second", lambda state: print("Running second step!"))
workflow.add_step("third", lambda state: print("Running third step!"))
await workflow.run(State(input="Hello"))
if __name__ == "__main__":
try:
asyncio.run(main())
except FrameworkError as e:
traceback.print_exc()
sys.exit(e.explain())