Spaces:
Sleeping
Sleeping
google-labs-jules[bot]
feat: implement AutoStream conversational AI sales agent with LangGraph
0643073 | from agent.state import AgentState | |
| def route_intent(state: AgentState) -> str: | |
| """ | |
| Router node that directs the workflow based on the detected intent. | |
| It returns the name of the next node to execute. | |
| """ | |
| intent = state.get("detected_intent") | |
| has_partial_lead = ( | |
| state.get("user_name") is not None or | |
| state.get("user_email") is not None or | |
| state.get("creator_platform") is not None | |
| ) and not state.get("lead_ready") | |
| if intent == "HIGH_INTENT_LEAD" or has_partial_lead: | |
| return "process_lead" | |
| elif intent in ["PRODUCT_QUERY", "PRICING_QUERY"]: | |
| return "retrieve_knowledge" | |
| elif intent == "GREETING": | |
| return "handle_greeting" | |
| else: | |
| return "handle_unknown" | |
| def route_after_lead(state: AgentState) -> str: | |
| """ | |
| Router node after process_lead to decide whether to execute the tool or stop. | |
| """ | |
| if state.get("lead_ready"): | |
| return "execute_tool" | |
| else: | |
| return "__end__" | |