Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created November 9, 2025 13:03
Show Gist options
  • Select an option

  • Save samirsaci/4cf38dcd9b5ed50c1275f17f5f9480c7 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/4cf38dcd9b5ed50c1275f17f5f9480c7 to your computer and use it in GitHub Desktop.
AI Agent Budget Planning - Parse Email Function
async def parse_email(state: AgentState) -> AgentState:
try:
parser = EmailParser(model_name=config["budget_agent"]["model_name"])
params = parser.parse(state["email_text"])
if not params or ("error" in params and params["error"]):
return {"error": f"Parse failed: {params.get('error', 'unknown')}"}
return {"params": params}
except Exception as e:
logger.exception("[BudgetGraph] parse_email crashed")
return {"error": f"Parse exception: {e}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment