Spaces:
Sleeping
Sleeping
Create executor.py
Browse files- app/agent/executor.py +24 -0
app/agent/executor.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tools_runtime import execute_tool_call
|
| 2 |
+
from agent import Agent
|
| 3 |
+
|
| 4 |
+
agent = Agent()
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class Executor:
|
| 8 |
+
|
| 9 |
+
def run_plan(self, plan):
|
| 10 |
+
|
| 11 |
+
results = []
|
| 12 |
+
|
| 13 |
+
for step in plan["steps"]:
|
| 14 |
+
|
| 15 |
+
print(f"🚀 Executing: {step}")
|
| 16 |
+
|
| 17 |
+
response = agent.run(step)
|
| 18 |
+
|
| 19 |
+
results.append({
|
| 20 |
+
"step": step,
|
| 21 |
+
"result": response
|
| 22 |
+
})
|
| 23 |
+
|
| 24 |
+
return results
|