Created
December 6, 2025 07:20
-
-
Save kennethleungty/1956f970d88a52fbb0bc4f2621d6b69d 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 router(state): | |
| # Read user intent from the current graph state. | |
| user_intent = state.get("intent") | |
| # Decide which agent to call next based on simple logic. | |
| # This demonstrates how you choose a target node. | |
| if user_intent == "search": | |
| return Command( | |
| update={"task": "run_search"}, # Update part of the state | |
| goto="search_agent" # Explicitly route to this node | |
| ) | |
| else: | |
| return Command( | |
| update={"task": "create_summary"}, | |
| goto="summary_agent" | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment