Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -88,7 +88,12 @@ workflow.set_entry_point("plan")
|
|
| 88 |
workflow.add_edge("plan", "act")
|
| 89 |
workflow.add_edge("act", "observe")
|
| 90 |
workflow.add_edge("observe", "decide")
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
workflow.add_edge("summarize", END)
|
| 94 |
|
|
|
|
| 88 |
workflow.add_edge("plan", "act")
|
| 89 |
workflow.add_edge("act", "observe")
|
| 90 |
workflow.add_edge("observe", "decide")
|
| 91 |
+
def route_decision(state: AgentState) -> str:
|
| 92 |
+
return "plan" if len(state["thoughts"]) < 3 else "summarize"
|
| 93 |
+
|
| 94 |
+
workflow.add_conditional_edges("decide", {
|
| 95 |
+
"plan": route_decision
|
| 96 |
+
})
|
| 97 |
|
| 98 |
workflow.add_edge("summarize", END)
|
| 99 |
|