adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

Unable to run the properly authenticated and registered ADK Agents through Agentspace

Open rushiiltecho opened this issue 1 year ago • 7 comments

Hello Google ADK and Cloud Team, We are trying to create Agents through Google-ADK that would work with Authentication based mechanisms with AgentSpace after registering them properly. We have followed a proper guide provided to our organization (Techolution) by Google, and after lots of efforts are unable to make the Authentication based ADK agents (that are properly registered and authorized, according to documentation) to work with Agentspace.

Following is a brief description of our exact issue:

  • After authenticating the deployed ADK agent ((on VertexAI Agent Engine))+ Registering it with Google Agentspace it asks for authorization, which is the expected behavior, and after the authentication is successful, it displays: "Something went wrong while answering your question. Please try again later." in the agentspace UI.

It is a kind request for help in resolving this. Following is the simple agent snippet, that I have deployed and tested:

import asyncio
import logging
from dotenv import load_dotenv
from google.adk.agents import Agent

load_dotenv()

import os
CLIENT_ID=os.getenv("CLIENT_ID")
CLIENT_SECRET=os.getenv("CLIENT_SECRET")

from customer_service.shared_libraries.google_api_toolset import CalendarToolset
from google.adk.agents import Agent
from google.adk.agents.callback_context import CallbackContext

calendar_tool_set = CalendarToolset()

def before_agent_callback(callback_context:CallbackContext):
    logging.info(f"\n{'*'*60}\n{'*'*60}\n\nCALLBACK_CONTEXT (Before agent):\n{callback_context.__dict__}\n\n{'*'*60}\n{'*'*60}\n")
    calendar_tool_set.configure_auth(
        client_id=CLIENT_ID, client_secret=CLIENT_SECRET
    )
    # session= callback_context._invocation_context.session_service.append_event()

def after_agent_callback(callback_context:CallbackContext):
    logging.info(f"\n{'*'*60}\n{'*'*60}\n\nCALLBACK_CONTEXT (After agent):\n{callback_context.__dict__}\n\n{'*'*60}\n{'*'*60}\n")

agent = Agent(
    name="calendar_agent",
    model="gemini-2.0-flash",              # or your preferred LLM
    before_agent_callback=before_agent_callback,
    after_agent_callback=after_agent_callback,
    tools=calendar_tool_set.get_tools()
)

Image

Any more information required can be given

rushiiltecho avatar Jun 02 '25 20:06 rushiiltecho

same issue here

salander0411 avatar Jun 04 '25 05:06 salander0411

Same issue. I traced the log and found that there was an API call (storeUserAuthorizationResponse). I would like to know how agent can get this credential info.

olifei avatar Jun 04 '25 06:06 olifei

I'm running into a 429 resource exhausted issue when registering. Anyone here can help me out explaining how to authenticate & register with agentspace?

"After authenticating the deployed ADK agent ((on VertexAI Agent Engine))+ Registering it with Google Agentspace it asks for authorization, which is the expected behavior, and after the authentication is successful"

When adding the agent in the configuration > assistant > add agent. I see this when opening the agent: Oh my, it seems our systems are overloaded at the moment. Please try again later.

EDIT: apparently in EU not yet possible. Your organization needs to be US, so not only agent and agentspace project hosted in US.

SAMFVH avatar Jun 04 '25 20:06 SAMFVH

Can you share if there's any documentation or resource available for registering custom agents from Vertex AI Agent Engine into AgentSpace? I'm wondering if I need a feature enabled because I don't see the option anywhere.

pbahng avatar Jun 06 '25 19:06 pbahng

To get AgentSpace to call AgentEngine ADK agents we simply added the permission Vertex AI User - (roles/aiplatform.user) to the service agent service-<PROJECT_NUMBER>@gcp-sa-discoveryengine.iam.gserviceaccount.com in the relevant project.

This immediately resolved the authentication issue and allowed us to make requests to the ADK agents from the 'root' agentspace search.

However, it still has a 429 when clicking on the ADK listed agent on the left for now. I suspect whilst the Google team is still blending the APIs and adding the new functionality these 'weird' issues will continue to show their faces :)

Hope this helps someone!

benjaminwestern avatar Jun 12 '25 00:06 benjaminwestern

I can reproduce this error with the demo agent from https://google.github.io/adk-docs/deploy/agent-engine/#initialization

Attached a script cli_deploy.py.txt with the example agent implemented with inline uv metadata so it can be executed by itself after changing the GCP project variables at the top:

PROJECT_ID = "mw-agentspace"
LOCATION = "us-central1"
STAGING_BUCKET = "gs://mw-agentspace-staging"

The agent deploys and I can see it listed in the GCP Agent Engine console UI. I can interact via ADK Python SDK with deployed the agent using the agent_engines.get(), agent.create_session(), and agent.stream_query() functions.

  • Added a dedicated service account with both Vertex AI Service Agent and Vertex AI User roles but the outcome didn't change

I see the same "Something went wrong while answering your question. Please try again later." message as others in Agentspace after adding the agent under "Agents" in the Agentspace "Assistants" tab.

  • Logs show no errors
Image Image Image

andrewginns avatar Jul 15 '25 11:07 andrewginns

Hi @rushiiltecho and thanks to everyone who participated in this thread.

We're currently doing some housekeeping on our issue tracker. Given the rapid pace of development and the number of updates since this was last active, there's a good chance this issue has been resolved in a newer version. To help us keep our backlog focused on current issues, we are closing this as stale.

If you're still facing this problem, could you please update to the very latest version of the library and confirm the issue still exists? If it does, please comment here, and we will be happy to reopen this issue and investigate further.

Thanks for your contribution and understanding!

klateefa avatar Oct 08 '25 05:10 klateefa