From fcc2cef9b29324657c487ff71bb963dd50fe1ba6 Mon Sep 17 00:00:00 2001 From: Jordan Ritter Date: Wed, 13 May 2026 23:45:26 -0700 Subject: [PATCH] fix(showcase): simplify health endpoints to local-only (no agent proxy) All 18 integration health endpoints previously proxied to the backend agent /health with a 3s timeout, causing false reds when agents were slow but functional. The harness already checks agent reachability via the agent: probe. Health endpoints now return a simple 200 confirming the Next.js process is alive. --- .../ag2/src/app/api/health/route.ts | 45 ++------------ .../agno/src/app/api/health/route.ts | 45 ++------------ .../src/app/api/health/route.ts | 34 +---------- .../src/app/api/health/route.ts | 45 ++------------ .../src/app/api/health/route.ts | 45 ++------------ .../crewai-crews/src/app/api/health/route.ts | 45 ++------------ .../google-adk/src/app/api/health/route.ts | 44 ++------------ .../src/app/api/health/route.ts | 48 ++------------- .../src/app/api/health/route.ts | 46 ++------------- .../src/app/api/health/route.ts | 48 ++------------- .../langroid/src/app/api/health/route.ts | 45 ++------------ .../llamaindex/src/app/api/health/route.ts | 45 ++------------ .../mastra/src/app/api/health/route.ts | 59 ++----------------- .../src/app/api/health/route.ts | 45 ++------------ .../src/app/api/health/route.ts | 45 ++------------ .../pydantic-ai/src/app/api/health/route.ts | 45 ++------------ .../spring-ai/src/app/api/health/route.ts | 45 ++------------ .../strands/src/app/api/health/route.ts | 45 ++------------ .../starter-template/app/api/health/route.ts | 44 ++------------ 19 files changed, 93 insertions(+), 770 deletions(-) diff --git a/showcase/integrations/ag2/src/app/api/health/route.ts b/showcase/integrations/ag2/src/app/api/health/route.ts index f792b67ff9..b88e4a7eb8 100644 --- a/showcase/integrations/ag2/src/app/api/health/route.ts +++ b/showcase/integrations/ag2/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "ag2", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/agno/src/app/api/health/route.ts b/showcase/integrations/agno/src/app/api/health/route.ts index b2ccedaaa3..e73ebc8f73 100644 --- a/showcase/integrations/agno/src/app/api/health/route.ts +++ b/showcase/integrations/agno/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "agno", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/built-in-agent/src/app/api/health/route.ts b/showcase/integrations/built-in-agent/src/app/api/health/route.ts index 487e9c62f7..adc1562102 100644 --- a/showcase/integrations/built-in-agent/src/app/api/health/route.ts +++ b/showcase/integrations/built-in-agent/src/app/api/health/route.ts @@ -1,37 +1,9 @@ -import type { NextRequest } from "next/server"; import { NextResponse } from "next/server"; -export const runtime = "nodejs"; - -// Health probe consumed by the showcase deploy verify step. Returns 200/ok -// only when the agent can actually run; degrades to 503 when OPENAI_API_KEY -// is missing so CI's `if [ "$HTTP_CODE" = "200" ]` gate cannot pass on a -// non-functional service. Mirrors langgraph-typescript's health pattern. -export function GET(req: NextRequest) { - const apiKeyPresent = Boolean(process.env.OPENAI_API_KEY); - const status: "ok" | "degraded" = apiKeyPresent ? "ok" : "degraded"; - - const publicResponse: Record = { - status, +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "built-in-agent", - backend: "tanstack-ai", timestamp: new Date().toISOString(), - }; - - // Extended diagnostics behind a debug token — exposing whether - // OPENAI_API_KEY is set on an unauthenticated probe lets attackers monitor - // key rotation. Ops debugging passes the token via header or query param. - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - if ( - token && - process.env.HEALTH_DEBUG_TOKEN && - token === process.env.HEALTH_DEBUG_TOKEN - ) { - publicResponse.openai_api_key = apiKeyPresent ? "set" : "NOT SET"; - } - - return NextResponse.json(publicResponse, { - status: apiKeyPresent ? 200 : 503, }); } diff --git a/showcase/integrations/claude-sdk-python/src/app/api/health/route.ts b/showcase/integrations/claude-sdk-python/src/app/api/health/route.ts index 8142b3072a..b561870273 100644 --- a/showcase/integrations/claude-sdk-python/src/app/api/health/route.ts +++ b/showcase/integrations/claude-sdk-python/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "claude-sdk-python", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/claude-sdk-typescript/src/app/api/health/route.ts b/showcase/integrations/claude-sdk-typescript/src/app/api/health/route.ts index 88b3910ec6..16cd177b6b 100644 --- a/showcase/integrations/claude-sdk-typescript/src/app/api/health/route.ts +++ b/showcase/integrations/claude-sdk-typescript/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "claude-sdk-typescript", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/crewai-crews/src/app/api/health/route.ts b/showcase/integrations/crewai-crews/src/app/api/health/route.ts index 0099eee3fb..5705dad8b6 100644 --- a/showcase/integrations/crewai-crews/src/app/api/health/route.ts +++ b/showcase/integrations/crewai-crews/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "crewai-crews", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/google-adk/src/app/api/health/route.ts b/showcase/integrations/google-adk/src/app/api/health/route.ts index f20b871ca5..bb8b949fbc 100644 --- a/showcase/integrations/google-adk/src/app/api/health/route.ts +++ b/showcase/integrations/google-adk/src/app/api/health/route.ts @@ -1,43 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "google-adk", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - GOOGLE_API_KEY: process.env.GOOGLE_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/langgraph-fastapi/src/app/api/health/route.ts b/showcase/integrations/langgraph-fastapi/src/app/api/health/route.ts index d57370a423..29114407e1 100644 --- a/showcase/integrations/langgraph-fastapi/src/app/api/health/route.ts +++ b/showcase/integrations/langgraph-fastapi/src/app/api/health/route.ts @@ -1,47 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = - process.env.AGENT_URL || - process.env.LANGGRAPH_DEPLOYMENT_URL || - "http://localhost:8123"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/ok`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "langgraph-fastapi", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/langgraph-python/src/app/api/health/route.ts b/showcase/integrations/langgraph-python/src/app/api/health/route.ts index 870f7f47ae..70ff9d542e 100644 --- a/showcase/integrations/langgraph-python/src/app/api/health/route.ts +++ b/showcase/integrations/langgraph-python/src/app/api/health/route.ts @@ -1,45 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const LANGGRAPH_URL = - process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${LANGGRAPH_URL}/ok`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "langgraph-python", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: LANGGRAPH_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/langgraph-typescript/src/app/api/health/route.ts b/showcase/integrations/langgraph-typescript/src/app/api/health/route.ts index d04dc26a46..3aa3c2b0b7 100644 --- a/showcase/integrations/langgraph-typescript/src/app/api/health/route.ts +++ b/showcase/integrations/langgraph-typescript/src/app/api/health/route.ts @@ -1,47 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = - process.env.AGENT_URL || - process.env.LANGGRAPH_DEPLOYMENT_URL || - "http://localhost:8123"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/ok`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "langgraph-typescript", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/langroid/src/app/api/health/route.ts b/showcase/integrations/langroid/src/app/api/health/route.ts index c7338aa9ee..63e6d81d72 100644 --- a/showcase/integrations/langroid/src/app/api/health/route.ts +++ b/showcase/integrations/langroid/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "langroid", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/llamaindex/src/app/api/health/route.ts b/showcase/integrations/llamaindex/src/app/api/health/route.ts index 7807cdde4f..da47aadef3 100644 --- a/showcase/integrations/llamaindex/src/app/api/health/route.ts +++ b/showcase/integrations/llamaindex/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "llamaindex", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/mastra/src/app/api/health/route.ts b/showcase/integrations/mastra/src/app/api/health/route.ts index 79ba62ac56..72ca28f687 100644 --- a/showcase/integrations/mastra/src/app/api/health/route.ts +++ b/showcase/integrations/mastra/src/app/api/health/route.ts @@ -1,58 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -export async function GET(req: NextRequest) { - const baseUrl = - process.env.NEXT_PUBLIC_BASE_URL || - `http://localhost:${process.env.PORT || 3000}`; - - let agentStatus = "unknown"; - try { - const res = await fetch(`${baseUrl}/api/copilotkit`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ - method: "agent/run", - params: { agentId: "agentic_chat" }, - body: { - threadId: "health-check", - runId: "health-check", - state: {}, - messages: [], - tools: [], - context: [], - forwardedProps: {}, - }, - }), - signal: AbortSignal.timeout(3000), - }); - // Any non-network-error response means runtime is alive - agentStatus = res.ok || res.status < 500 ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "mastra", - agent: "in-process", timestamp: new Date().toISOString(), - }; - - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - runtime: "in-process (mastra)", - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/ms-agent-dotnet/src/app/api/health/route.ts b/showcase/integrations/ms-agent-dotnet/src/app/api/health/route.ts index 9ad78a8704..a7abb99c9f 100644 --- a/showcase/integrations/ms-agent-dotnet/src/app/api/health/route.ts +++ b/showcase/integrations/ms-agent-dotnet/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "ms-agent-dotnet", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/ms-agent-python/src/app/api/health/route.ts b/showcase/integrations/ms-agent-python/src/app/api/health/route.ts index 470b6ffa76..50953f5bd2 100644 --- a/showcase/integrations/ms-agent-python/src/app/api/health/route.ts +++ b/showcase/integrations/ms-agent-python/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "ms-agent-python", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/pydantic-ai/src/app/api/health/route.ts b/showcase/integrations/pydantic-ai/src/app/api/health/route.ts index 8de1ef3942..c59064b958 100644 --- a/showcase/integrations/pydantic-ai/src/app/api/health/route.ts +++ b/showcase/integrations/pydantic-ai/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "pydantic-ai", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/spring-ai/src/app/api/health/route.ts b/showcase/integrations/spring-ai/src/app/api/health/route.ts index 20fda5d1e8..09e2bc97cf 100644 --- a/showcase/integrations/spring-ai/src/app/api/health/route.ts +++ b/showcase/integrations/spring-ai/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "spring-ai", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/integrations/strands/src/app/api/health/route.ts b/showcase/integrations/strands/src/app/api/health/route.ts index 6b2fa9ba36..9654ce9630 100644 --- a/showcase/integrations/strands/src/app/api/health/route.ts +++ b/showcase/integrations/strands/src/app/api/health/route.ts @@ -1,44 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000"; - -export async function GET(req: NextRequest) { - // Check agent backend reachability - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - // Public response: safe to expose - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "strands", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - // Extended diagnostics: only with debug token - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); } diff --git a/showcase/shared/starter-template/app/api/health/route.ts b/showcase/shared/starter-template/app/api/health/route.ts index 536cc5514b..f488784c96 100644 --- a/showcase/shared/starter-template/app/api/health/route.ts +++ b/showcase/shared/starter-template/app/api/health/route.ts @@ -1,43 +1,9 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; -const AGENT_URL = - process.env.AGENT_URL || - process.env.LANGGRAPH_DEPLOYMENT_URL || - "http://localhost:8123"; - -export async function GET(req: NextRequest) { - let agentStatus = "unknown"; - try { - const res = await fetch(`${AGENT_URL}/health`, { - signal: AbortSignal.timeout(3000), - }); - agentStatus = res.ok ? "ok" : "error"; - } catch { - agentStatus = "down"; - } - - const publicResponse: Record = { - status: agentStatus === "ok" ? "ok" : "degraded", +export async function GET() { + return NextResponse.json({ + status: "ok", integration: "{{SLUG}}", - agent: agentStatus, timestamp: new Date().toISOString(), - }; - - const token = - req.headers.get("x-debug-token") || req.nextUrl.searchParams.get("debug"); - const expectedToken = process.env.SHOWCASE_DEBUG_TOKEN; - - if (token && expectedToken && token === expectedToken) { - publicResponse.diagnostics = { - agent_url: AGENT_URL, - env: { - OPENAI_API_KEY: process.env.OPENAI_API_KEY ? "set" : "NOT SET", - NODE_ENV: process.env.NODE_ENV, - PORT: process.env.PORT, - }, - }; - } - - const httpStatus = publicResponse.status === "ok" ? 200 : 503; - return NextResponse.json(publicResponse, { status: httpStatus }); + }); }