Skip to content

Commit 2bac901

Browse files
committed
fix(showcase/ms-agent-python): drop trailing slash on subpath HttpAgent URLs
The mcp-apps and voice-demo HttpAgent URLs had a trailing slash (`${AGENT_URL}/mcp-apps/`, `${AGENT_URL}/voice/`), but the FastAPI backend in agent_server.py mounts those agents at `/mcp-apps` and `/voice` exactly. Posting to the trailing-slash URL triggers FastAPI's default `redirect_slashes` 307, which drops the SSE streaming body and surfaces in the runtime as `RUN_ERROR: fetch failed (INCOMPLETE_STREAM)` for every pill click on the deployed ms-agent-python showcase. Reproduced live against showcase-ms-agent-python-production. Every other ms-agent-python HttpAgent URL (`/hitl-in-app`, `/headless-complete`, `/multimodal`, `/agent-config`, etc.) already uses no trailing slash and works fine, confirming the trailing slash is the only delta.
1 parent c91a3bd commit 2bac901

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

  • showcase/integrations/ms-agent-python/src/app/api

showcase/integrations/ms-agent-python/src/app/api/copilotkit-mcp-apps/[[...slug]]/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ import { HttpAgent } from "@ag-ui/client";
2525

2626
const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000";
2727

28-
const mcpAppsAgent = new HttpAgent({ url: `${AGENT_URL}/mcp-apps/` });
28+
// No trailing slash on the URL. FastAPI mounts this agent at `/mcp-apps`
29+
// exactly (via `add_agent_framework_fastapi_endpoint(path="/mcp-apps")` in
30+
// agent_server.py); posting to `/mcp-apps/` triggers FastAPI's
31+
// redirect-to-canonical 307, which kills the streaming SSE response and
32+
// surfaces as `fetch failed` / `INCOMPLETE_STREAM` in the runtime.
33+
const mcpAppsAgent = new HttpAgent({ url: `${AGENT_URL}/mcp-apps` });
2934

3035
// headless-complete shares this runtime because its cell also exercises
3136
// MCP Apps activity rendering (the "Sketch a diagram" pill exercises the

showcase/integrations/ms-agent-python/src/app/api/copilotkit-voice/[[...slug]]/route.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ const AGENT_URL = process.env.AGENT_URL || "http://localhost:8000";
2929

3030
// Point at the tool-free /voice endpoint so aimock returns a direct text
3131
// response instead of a tool call that the agent can't summarize.
32-
const voiceDemoAgent = new HttpAgent({ url: `${AGENT_URL}/voice/` });
32+
//
33+
// No trailing slash on the URL. FastAPI mounts this agent at `/voice`
34+
// exactly (via `add_agent_framework_fastapi_endpoint(path="/voice")` in
35+
// agent_server.py); posting to `/voice/` triggers FastAPI's
36+
// redirect-to-canonical 307, which kills the streaming SSE response and
37+
// surfaces as `fetch failed` / `INCOMPLETE_STREAM` in the runtime.
38+
const voiceDemoAgent = new HttpAgent({ url: `${AGENT_URL}/voice` });
3339

3440
/**
3541
* Transcription service wrapper that reports a clean, typed auth error when

0 commit comments

Comments
 (0)