@@ -24,10 +24,12 @@ def greet(name: str) -> str:
2424 """Generate a simple greeting."""
2525 return f"Hello, { name } !"
2626
27+
2728def uppercase (greeting : str ) -> str :
2829 """Convert text to uppercase."""
2930 return greeting .upper ()
3031
32+
3133async def main ():
3234 print ("🚀 Setting up Manual Agent..." )
3335
@@ -42,9 +44,9 @@ async def main():
4244 "id" : "greeting_generated" ,
4345 "description" : "Greeting produced" ,
4446 "metric" : "custom" ,
45- "target" : "any"
47+ "target" : "any" ,
4648 }
47- ]
49+ ],
4850 )
4951
5052 # 3. Define Nodes
@@ -56,7 +58,7 @@ async def main():
5658 node_type = "function" ,
5759 function = "greet" , # Matches the registered function name
5860 input_keys = ["name" ],
59- output_keys = ["greeting" ]
61+ output_keys = ["greeting" ],
6062 )
6163
6264 node2 = NodeSpec (
@@ -66,7 +68,7 @@ async def main():
6668 node_type = "function" ,
6769 function = "uppercase" ,
6870 input_keys = ["greeting" ],
69- output_keys = ["final_greeting" ]
71+ output_keys = ["final_greeting" ],
7072 )
7173
7274 # 4. Define Edges
@@ -75,7 +77,7 @@ async def main():
7577 id = "greet-to-upper" ,
7678 source = "greeter" ,
7779 target = "uppercaser" ,
78- condition = EdgeCondition .ON_SUCCESS
80+ condition = EdgeCondition .ON_SUCCESS ,
7981 )
8082
8183 # 5. Create Graph
@@ -92,6 +94,7 @@ async def main():
9294 # 6. Initialize Runtime & Executor
9395 # Runtime handles state/memory; Executor runs the graph
9496 from pathlib import Path
97+
9598 runtime = Runtime (storage_path = Path ("./agent_logs" ))
9699 executor = GraphExecutor (runtime = runtime )
97100
@@ -103,11 +106,7 @@ async def main():
103106 # 8. Execute Agent
104107 print ("▶ Executing agent with input: name='Alice'..." )
105108
106- result = await executor .execute (
107- graph = graph ,
108- goal = goal ,
109- input_data = {"name" : "Alice" }
110- )
109+ result = await executor .execute (graph = graph , goal = goal , input_data = {"name" : "Alice" })
111110
112111 # 9. Verify Results
113112 if result .success :
@@ -117,6 +116,7 @@ async def main():
117116 else :
118117 print (f"\n ❌ Failed: { result .error } " )
119118
119+
120120if __name__ == "__main__" :
121121 # Optional: Enable logging to see internal decision flow
122122 # logging.basicConfig(level=logging.INFO)
0 commit comments