Repository navigation
Conversation
jmesnil
left a comment
There was a problem hiding this comment.
This PR is quite long and difficult to review...
I've a preliminary question before I dive into it.
If I understand correctly, multi-tenant agent cards are served at https://{server_domain}/.well-known/{tenant}/agent-card.json.
Why that choice and not the simpler https://{server_domain}/{tenant}/.well-known/agent-card.json with the tenant in the authority/base path and the well-known suffix intact.
Moving the tenant in the authority/base path would simplify the code and avoid the whole normalization issue of the tenant if it's in the middle of the agent card url.
| */ | ||
| T create(C clientTransportConfig, AgentCard agentCard, AgentInterface agentInterface) throws A2AClientException; | ||
|
|
||
| /** @return whether the transport runs the tenant routing interceptor phase */ |
There was a problem hiding this comment.
This description is very cryptic, I don't understand what this could even mean....
There was a problem hiding this comment.
This is used to fail if the ClientRoutingInterceptor is present and the ClientTransportProvider doesn't support it
| * @param tenant supplied tenant identifier | ||
| * @return the canonical tenant, or null for an unscoped request | ||
| */ | ||
| public static @Nullable String canonicalizeTenant(@Nullable String tenant) { |
There was a problem hiding this comment.
To verify but this method is only called on the client side of the SDK. There is no canonicalization of the tenant on the server side.
The server side call validateTenant which accepts . and .. according to VALID_TENANT_CHARS.
|
@jmesnil well it was because I still wanted the agent cards under the .well-known/ path element. Didn't seem such a bad idea then :( |
Honor redirect opt-in for requests with allowlisted headers. Log the first suppression per transport without printing header values. BREAKING CHANGE: An authentication interceptor or a header outside the allowlist disables transport-level POST redirects. Signed-off-by: Emmanuel Hugonnet <[email protected]>
Evaluate Agent Card alternatives in order. Apply credentials for every scheme in the selected alternative and preserve anonymous alternatives. Signed-off-by: Emmanuel Hugonnet <[email protected]>
Use the protobuf request returned by the interceptor chain for v0.3 calls, including builder replacements. Signed-off-by: Emmanuel Hugonnet <[email protected]>
Use explicit imports in the transport and response correlation tests. Signed-off-by: Emmanuel Hugonnet <[email protected]>
Exercise HTTP and HTTPS Host handling across the built-in clients using local test fixtures. Signed-off-by: Emmanuel Hugonnet <[email protected]>
Use shared port and authority constants for reference and multiversion tests. Signed-off-by: Emmanuel Hugonnet <[email protected]>
|
@jmesnil I think we should split this PR in a serie of PRs. WDYT ? |
• This PR updates the A2A client transports so tenant routing, interceptor changes, and the request sent over the wire agree. It also makes HTTP client ownership and stream shutdown explicit.
• Routing and request construction. REST, JSON-RPC, and gRPC resolve the v1.0 tenant before ordinary interceptors run. Use ClientRoutingInterceptor.routeTenant() to change it. REST encodes resource IDs as individual path segments and builds list queries from the intercepted request. v0.3 gRPC sends the request returned by the interceptor chain.
• HTTP behavior. Transports validate and normalize endpoints before allocating clients. Closing a REST transport cancels active streams, and transports release the HTTP clients they own. getHttpClient() can return null when no client was supplied. POST redirects require opt-in and are suppressed when an authentication interceptor is configured or a header falls outside the allowlist.
• Security alternatives. The SDK selects the first Agent Card alternative it can satisfy in full, including an anonymous alternative when advertised.
Targeted tests passed for endpoint validation, default-port Host headers over HTTP and HTTPS, stream shutdown, tenant routing, interceptor behavior, and security alternative selection.