Created
December 5, 2025 15:28
-
-
Save kennethleungty/1ff479c72030acafe05672c8b9b9370b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def should_continue( | |
| state: SupervisorState, | |
| ) -> Literal["transaction_history_agent", "property_profile_agent", "end"]: | |
| """Extract routing decision from supervisor's message. | |
| Looks for agent names in the supervisor's latest message to determine routing. | |
| Returns "end" if supervisor provides a direct response (no routing needed). | |
| """ | |
| # Find latest supervisor message | |
| for msg in reversed(state["messages"]): | |
| if ( | |
| isinstance(msg, AIMessage) | |
| and hasattr(msg, "name") | |
| and msg.name == "supervisor" | |
| ): | |
| content = msg.content.strip().lower() | |
| # Check for agent names in content | |
| if "transaction_history_agent" in content: | |
| return "transaction_history_agent" | |
| elif "property_profile_agent" in content: | |
| return "property_profile_agent" | |
| return "end" # No agent name found - supervisor handled directly | |
| return "end" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment