Skip to content

fix(client): export TenantTransportDecorator and fix docstring#915

Open
4444J99 wants to merge 1 commit intoa2aproject:1.0-devfrom
4444J99:fix/tenant-decorator-export-and-docstring
Open

fix(client): export TenantTransportDecorator and fix docstring#915
4444J99 wants to merge 1 commit intoa2aproject:1.0-devfrom
4444J99:fix/tenant-decorator-export-and-docstring

Conversation

@4444J99
Copy link
Copy Markdown

@4444J99 4444J99 commented Mar 30, 2026

Summary

TenantTransportDecorator is used internally by ClientFactory to wrap transports when an AgentInterface specifies a tenant, but it is not exported from the a2a.client.transports package. This means users who need to compose transport decorators manually (e.g. stacking tenant resolution with a future RetryTransport) must import from the private module path.

This PR:

  • Exports TenantTransportDecorator from a2a.client.transports.__init__ and adds it to __all__, consistent with how ClientTransport, JsonRpcTransport, RestTransport, and GrpcTransport are exported.
  • Fixes the send_message() docstring which incorrectly read "Sends a streaming message request to the agent and yields responses as they arrive" — a copy-paste from send_message_streaming(). Corrected to "Sends a non-streaming message request to the agent."
  • Adds test coverage for close() delegation and async context manager usage, verifying the decorator properly delegates lifecycle management to the underlying transport.

Test plan

  • All 14 test_tenant_decorator.py tests pass (12 existing + 2 new)
  • Verified from a2a.client.transports import TenantTransportDecorator resolves correctly

- Add TenantTransportDecorator to transports __init__.py __all__
  so it is importable via `from a2a.client.transports import
  TenantTransportDecorator` alongside the other transports.

- Fix send_message() docstring that incorrectly described it as
  a streaming method (copy-paste from send_message_streaming).

- Add test coverage for close() delegation and async context
  manager usage, verifying the decorator properly delegates
  lifecycle management to the underlying transport.
@4444J99 4444J99 requested a review from a team as a code owner March 30, 2026 21:45
@github-actions
Copy link
Copy Markdown

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/transports/tenant_decorator.py 97.87% 100.00% 🟢 +2.13%
Total 91.59% 91.60% 🟢 +0.01%

Generated by coverage-comment.yml

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request exports the TenantTransportDecorator in the transports package, corrects a docstring in the decorator to accurately describe the non-streaming nature of the send_message method, and adds unit tests to verify that the decorator correctly delegates the close method and functions as an async context manager. I have no feedback to provide.

@ishymko
Copy link
Copy Markdown
Member

ishymko commented Apr 1, 2026

Thank you for the PR!

This type is not exported by design and is considered to be an implementation detail. For the mentioned relation to the future RetryTransport we may reconsider it later.

Feel free to factor out other fixes so that we can merge them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants