google adk erroring out with Failed in retrieving contexts due to: ', PermissionDenied('Agent Platform API has not been used in project your-project-id before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/aiplatform.googleapis.com/overview?project=your-project-id then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry
Bump into this error when trying to setup my agent to query Agentic platform RAG. Despite checking that I have the right permission and then ensure the key environemnts variable are configured correctly
GOOGLE_CLOUD_LOCATION=us-central1
GOOGLE_GENAI_USE_VERTEXAI=TRUE
Yet this error keeps on coming up
RuntimeError: ('Failed in retrieving contexts due to: ', PermissionDenied('Agent Platform API has not been used in project your-project-id before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/aiplatform.googleapis.com/overview?project=your-project-id then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.'))
Then I place this in my code to force it and then I was able to resolve it.
import vertexai
# Ensure this matches your actual GCP Project ID, not a placeholder
vertexai.init(project="project-your-project-id", location="us-central1")
Comments