Browse Source

fix: resolve Railway deployment crash — wealth_bridge.py used agent.tools absolute imports that fail without PYTHONPATH; add sys.path fallback pattern to work in both local and Railway environments

Made-with: Cursor
pull/6453/head
Priyanka Punukollu 1 month ago
parent
commit
31964ae716
  1. 2
      agent/main.py
  2. 2
      agent/requirements.txt
  3. 24
      agent/tools/wealth_bridge.py

2
agent/main.py

@ -592,7 +592,7 @@ async def health():
"status": "ok", "status": "ok",
"ghostfolio_reachable": ghostfolio_ok, "ghostfolio_reachable": ghostfolio_ok,
"timestamp": datetime.utcnow().isoformat(), "timestamp": datetime.utcnow().isoformat(),
"version": "2.0.0-complete-showcase", "version": "2.1.0-complete-showcase",
"features": ["relocation_runway", "wealth_gap", "life_decision", "equity_unlock", "family_planner"], "features": ["relocation_runway", "wealth_gap", "life_decision", "equity_unlock", "family_planner"],
} }

2
agent/requirements.txt

@ -8,3 +8,5 @@ httpx
python-dotenv python-dotenv
pytest pytest
pytest-asyncio pytest-asyncio
# cache-bust-1772149708

24
agent/tools/wealth_bridge.py

@ -21,14 +21,29 @@ Mortgage assumption: 30-year fixed at 6.95%, 20% down, payment × 1.25
""" """
import asyncio import asyncio
import sys
import os
from typing import Optional from typing import Optional
from agent.tools.real_estate import _MOCK_SNAPSHOTS, _normalize_city sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from agent.tools.teleport_api import (
try:
from real_estate import _MOCK_SNAPSHOTS, _normalize_city
except ImportError:
from agent.tools.real_estate import _MOCK_SNAPSHOTS, _normalize_city
try:
from teleport_api import (
HARDCODED_FALLBACK, HARDCODED_FALLBACK,
_is_austin_area, _is_austin_area,
get_city_housing_data, get_city_housing_data,
) )
except ImportError:
from agent.tools.teleport_api import (
HARDCODED_FALLBACK,
_is_austin_area,
get_city_housing_data,
)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# COL index values for Austin TX sub-markets (ACTRIS coverage areas) # COL index values for Austin TX sub-markets (ACTRIS coverage areas)
@ -468,6 +483,9 @@ async def get_portfolio_real_estate_summary(
Returns: Returns:
Combined dict with portfolio_summary, down_payment_analysis, quick_answer. Combined dict with portfolio_summary, down_payment_analysis, quick_answer.
""" """
try:
from portfolio import portfolio_analysis
except ImportError:
from agent.tools.portfolio import portfolio_analysis from agent.tools.portfolio import portfolio_analysis
portfolio_result = await portfolio_analysis() portfolio_result = await portfolio_analysis()

Loading…
Cancel
Save