-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfallback_final.py
More file actions
30 lines (20 loc) · 951 Bytes
/
fallback_final.py
File metadata and controls
30 lines (20 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Nodo 8: Fallback Final - Stops processing when risky content is detected."""
import logging
from app.agents.state import AgentState
logger = logging.getLogger(__name__)
def fallback_final(state: AgentState) -> AgentState:
"""
Fallback Final node - Stops processing when risky content is detected.
This node:
1. Sets error message indicating that the information requested is classified or not free to know
2. Stops the flow by routing to END
Args:
state: Agent state containing the response flagged as risky
Returns:
Updated state with error_message set, ready to route to END
"""
updated_state = state.copy()
# Set error message for risky content
updated_state["error_message"] = "The information requested is classified or not free to know."
logger.warning("Risky content detected. Stopping processing. Response content not logged for security.")
return updated_state