How to use RemoteA2aAgent with authentication for agent card? #70
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: You can handle authentication by creating and configuring an Hello! Based on the ADK's design, you can provide a custom HTTP client to the Here is how you can configure a client for basic authentication and use it with your First, you'll need to import the necessary libraries, import base64
import httpx
from google.adk.agents import RemoteA2aAgent
from google.adk.agents.remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH Next, create an # Your credentials
username = "your_username"
password = "your_password"
# Encode credentials for Basic Auth
auth_bytes = f"{username}:{password}".encode("utf-8")
auth_header = f"Basic {base64.b64encode(auth_bytes).decode('utf-8')}"
# Create a client with the authentication header
client = httpx.AsyncClient(
headers={"Authorization": auth_header}
) Finally, pass this pre-configured client to the bigquery_agent = RemoteA2aAgent(
name="bigquery_agent",
description="Help customer to manage notion workspace.",
agent_card=(
f"http://localhost:8001/a2a/bigquery_agent{AGENT_CARD_WELL_KNOWN_PATH}"
),
httpx_client=client,
) By using this method, all requests made by the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m trying to use RemoteA2aAgent in my code as shown below:
Sample code I'm using to call the remote agent :
For the agent card I'm using it requires the username and password when ever open the link in the browser
The issue I’m facing is that the agent card URL requires authentication (username and password) . Because of this, the agent fails to call the remote agent.
My Question:
How can I configure RemoteA2aAgent to work with an agent card that requires basic authentication (username/password)?
Is there a way to pass credentials in the RemoteA2aAgent configuration?
Or do I need to handle authentication separately before making the call?
Any examples or best practices would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions