Skip to content

Instantly share code, notes, and snippets.

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

  • Save samirsaci/63de675e0ae093deb0a1f08b507fb592 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/63de675e0ae093deb0a1f08b507fb592 to your computer and use it in GitHub Desktop.
AI Agent Budget Planning - Run Budget
async def run_budget(state: AgentState) -> AgentState:
if "error" in state:
return {}
try:
interpreter = BudgetPlanInterpreter(
model_name=config["budget_agent"]["model_name"],
session_id=state.get("session_id",
config["budget_agent"]["session_id"]))
results = await interpreter.run_plan(state["params"])
if "error" in results:
return {"error": f"Budget run failed: {results['error']}"}
return {"budget_results": results, "interpreter": interpreter}
except Exception as e:
logger.exception("[BudgetGraph] run_budget crashed")
return {"error": f"Budget exception: {e}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment