Repository navigation
fix: correct well-known URL construction for agent base with paths - #70
caio-henrique wants to merge 1 commit into
Conversation
|
Thanks @caio-henrique for digging into this! I tested the change against a local HTTP server. With the SDK currently on |
…ative card path The SDK resolves the card path against the agent URL, so the resolver prefixes the agent's own path. Normalise the join: a base URL ending in "/" no longer produces "//" (or fails for "http://host/"), and a card path without a leading "/" is no longer glued onto the agent path. Adds A2ASubagentResolverTest, which checks the requested path against a local HTTP server. Based on the analysis in #70 by @caio-henrique.
|
Thanks again @caio-henrique — your report led to a real fix. On the current SDK (0.3.3) the default case worked, but a base URL with a trailing slash (including |
Description
This PR fixes a bug in
A2ASubagentResolverwhere the well‑known agent card URL was being constructed with duplicated path segments when the agent base URI already contained a path.Problem
The previous implementation appended the base path twice, causing the agent’s sub‑path (e.g.,
/dominio) to appear duplicated in the final URL. This resulted in HTTP 404 errors for agents deployed with a context path.Solution
The URL construction logic has been changed to:
/).agentCardPathto treat it as a relative path.This change eliminates the path duplication and handles the following cases:
agentCardPathvalues (with and without leading/)Testing
Parameterized tests have been added covering multiple scenarios. All tests pass.
http://localhost:8080/dominiohttp://localhost:8080/dominio/dominio/.well-known/agent-card.jsonhttp://localhost:8080/dominio/.well-known/agent-card.jsonhttp://localhost:8080http://localhost:8080/.well-known/agent-card.jsonhttp://localhost:8080/.well-known/agent-card.json(unchanged)Checklist