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:<slug> probe. Health endpoints now return a simple 200
confirming the Next.js process is alive.
This commit is contained in:
Jordan Ritter
2026-05-13 23:45:26 -07:00
parent e50737fcaf
commit fcc2cef9b2
19 changed files with 93 additions and 770 deletions
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, unknown> = {
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,
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, unknown> = {
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 });
});
}
@@ -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<string, unknown> = {
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 });
});
}
@@ -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<string, unknown> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, unknown> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, any> = {
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 });
});
}
@@ -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<string, unknown> = {
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 });
});
}