-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (26 loc) · 1017 Bytes
/
main.py
File metadata and controls
33 lines (26 loc) · 1017 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
30
31
32
33
# Copyright (c) Microsoft. All rights reserved.
"""Simple workflow sample - demonstrates basic variable setting and output."""
import asyncio
from pathlib import Path
from agent_framework.declarative import WorkflowFactory
async def main() -> None:
"""Run the simple greeting workflow."""
# Create a workflow factory
factory = WorkflowFactory()
# Load the workflow from YAML
workflow_path = Path(__file__).parent / "workflow.yaml"
workflow = factory.create_workflow_from_yaml_path(workflow_path)
print(f"Loaded workflow: {workflow.name}")
print("-" * 40)
# Run with default name
print("\nRunning with default name:")
result = await workflow.run({})
for output in result.get_outputs():
print(f" Output: {output}")
# Run with a custom name
print("\nRunning with custom name 'Alice':")
result = await workflow.run({"name": "Alice"})
print("\n" + "-" * 40)
print("Workflow completed!")
if __name__ == "__main__":
asyncio.run(main())