Dev: derive AGENT_URL from BACKEND_URL so the assistant works locally
Some checks failed
Deploy to VPS / test (push) Successful in 1m31s
Deploy to VPS / deploy (push) Failing after 1m54s

The default pointed at the compose-internal 'backend' hostname, which
never resolves when the Hono runtime runs on the host — every local
agent run died with fetch failed/ENOTFOUND before reaching FastAPI.
Prod is unaffected (sets both URLs explicitly).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Carlos Escalante
2026-07-04 14:16:25 -06:00
parent ce7073cf24
commit 37c2b18300

View File

@@ -9,10 +9,12 @@ import { HttpAgent, Middleware, EventType } from "@ag-ui/client";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { Hono } from "hono"; import { Hono } from "hono";
const AGENT_URL =
process.env.AGENT_URL ?? "http://backend:8000/api/v1/agent/agui";
const BACKEND_URL = const BACKEND_URL =
process.env.BACKEND_URL ?? "http://localhost:8001"; process.env.BACKEND_URL ?? "http://localhost:8001";
// Prod sets AGENT_URL explicitly (compose network); the default derives from
// BACKEND_URL so local dev reaches the docker backend published on :8001.
const AGENT_URL =
process.env.AGENT_URL ?? `${BACKEND_URL}/api/v1/agent/agui`;
const isProd = process.env.NODE_ENV === "production"; const isProd = process.env.NODE_ENV === "production";
const PORT = parseInt(process.env.PORT ?? (isProd ? "3000" : "3001")); const PORT = parseInt(process.env.PORT ?? (isProd ? "3000" : "3001"));