Python: A2A AuthInterceptor Support (#1317)

* a2a authinterceptor support

* Update python/packages/a2a/agent_framework_a2a/_agent.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* small fix

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Giles Odigwe
2025-10-09 11:56:54 -07:00
committed by GitHub
Unverified
parent 9fe4a61dd0
commit 2f53ce4abd
2 changed files with 23 additions and 1 deletions
@@ -497,3 +497,21 @@ def test_a2a_parts_to_contents_with_hosted_file_uri() -> None:
assert isinstance(contents[0], UriContent)
assert contents[0].uri == "hosted://storage/document.pdf"
assert contents[0].media_type == "" # Converted None to empty string
def test_auth_interceptor_parameter() -> None:
"""Test that auth_interceptor parameter is accepted without errors."""
# Create a mock auth interceptor
mock_auth_interceptor = MagicMock()
# Test that A2AAgent can be created with auth_interceptor parameter
# Using url parameter for simplicity
agent = A2AAgent(
name="test-agent",
url="https://test-agent.example.com",
auth_interceptor=mock_auth_interceptor,
)
# Verify the agent was created successfully
assert agent.name == "test-agent"
assert agent.client is not None