Skip to content

Commit dca50b7

Browse files
authored
fix(showcase): remove trailing slash from ms-agent-python hitl-in-app agent URL (CopilotKit#4486)
## Summary - Remove trailing slash from the `hitl-in-app` agent URL in ms-agent-python's CopilotKit route handler ## Why The `hitl-in-app` agent was the **only** agent registered with a trailing slash in the URL (`/hitl-in-app/`). The FastAPI backend mounts the endpoint at `/hitl-in-app` (no slash). FastAPI's default `redirect_slashes=True` returns a **307 redirect** for POST requests to the trailing-slash variant, and the AG-UI `HttpAgent` does not follow POST redirects during streaming. This caused the agent to appear completely unresponsive — the D5 `hitl-approve-deny` probe timed out at 60s with `baseline=0, current=0` (zero assistant messages). Verified via container: `POST /hitl-in-app/` returns 307 → `POST /hitl-in-app` returns 422 (correct routing, body validation). The fix uses the shared `createAgent("/hitl-in-app")` helper (which does not append a trailing slash) for consistency with every other agent registration in the file. ## Test plan - [ ] D5 `hitl-approve-deny` passes for ms-agent-python (`showcase test ms-agent-python --d5`) - [ ] No regression in other ms-agent-python D5 features (10/11 → 11/11)
2 parents b1c7088 + b3fb898 commit dca50b7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

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

showcase/integrations/ms-agent-python/src/app/api/copilotkit/route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ for (const name of agentNames) {
5252
agents[name] = createAgent();
5353
}
5454
// In-App HITL -- async frontend-tool + app-level modal (outside chat).
55-
// Points at the dedicated hitl-in-app agent mounted at /hitl-in-app on the
56-
// FastAPI backend; the agent has tools=[] and a system prompt tailored to
57-
// the frontend-provided `request_user_approval` tool.
58-
agents["hitl-in-app"] = new HttpAgent({ url: `${AGENT_URL}/hitl-in-app/` });
55+
// Dedicated hitl-in-app agent mounted at /hitl-in-app on the FastAPI
56+
// backend; agent has tools=[] and relies on the frontend-provided
57+
// `request_user_approval` tool injected by CopilotKit at request time.
58+
agents["hitl-in-app"] = createAgent("/hitl-in-app");
5959

6060
// In-Chat HITL -- frontend-defined `book_call` tool rendered inline in the
6161
// chat via `useHumanInTheLoop`. Backend agent has tools=[] and routes to

0 commit comments

Comments
 (0)