Created
November 9, 2025 13:04
-
-
Save samirsaci/0a73b10aef7a61086a4b8a146e2c813f to your computer and use it in GitHub Desktop.
AI Agent Budget Planning - Summarize Function
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
| async def summarize(state: AgentState) -> AgentState: | |
| if "error" in state: | |
| return {} | |
| try: | |
| interpreter = state.get("interpreter") or BudgetPlanInterpreter( | |
| model_name=config["budget_agent"]["model_name"], | |
| session_id=state.get("session_id", config["budget_agent"]["session_id"]), | |
| ) | |
| html = await interpreter.interpret(state["params"], state["budget_results"]) | |
| return {"html_summary": html} | |
| except Exception as e: | |
| logger.exception("[BudgetGraph] summarize crashed") | |
| return {"error": f"Summarization exception: {e}"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment