AlgoSensei / agent /nodes /validate_node.py
uncertainrods's picture
init_code
e266561
"""
validate_node.py — Returns a success response when the user's reasoning is correct.
No LLM call — purely deterministic.
"""
from agent.models import AgentState
from agent.memory import load_profile, update_profile, persist_profile
def validate_solution(state: AgentState) -> dict:
"""Validates that the user's approach is correct and returns a success response."""
session_id = state.get("session_id", "anonymous")
# Mark as solved in the user's profile
try:
profile = load_profile(session_id)
profile = update_profile(
profile,
topic=state.get("problem_topic", "unknown"),
gap_magnitude=0,
solved=True,
)
persist_profile(profile)
except Exception as e:
print(f"[validate_node] Memory error: {e}")
return {
"final_response": {
"hint": (
"✅ Great job! Your reasoning is sound and your approach is optimal. "
"You can proceed to implementation or explore further optimizations."
),
"type": "Validation",
"score": 100,
}
}