AdkApp: user_id always defaults to 'default-user-id' when called from Google Agentspace
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- google-cloud, python
- Área
- api, authentication, cloud
Línea de trabajo
Comienza en vertexai/agent_engines/templates/adk.py, leyendo _StreamRunRequest y streaming_agent_run_with_events() alrededor de las líneas referenciadas. Traza cómo se representan el JSON de la solicitud entrante y el contexto autenticado de la solicitud antes de asignar el ID de usuario predeterminado. Se considera terminado cuando la identidad del usuario de Agentspace llega a la sesión de ADK y a la ruta de analytics, con cobertura de regresión para las solicitudes que omiten user_id.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
| Component | Value |
|---|---|
| Package | google-cloud-aiplatform |
| File | vertexai/agent_engines/templates/adk.py |
| Python | 3.12 |
| Deployment | Vertex AI Agent Engine via Agentspace |
Description
When ADK agents are deployed to Google Agentspace and users interact through the Agentspace UI, user_id is always "default-user-id" for all sessions and events. The real user identity (IAM principal/email) is never propagated, making per-user analytics impossible.
Root cause
In vertexai/agent_engines/templates/adk.py, line 97:
_DEFAULT_USER_ID = "default-user-id"
The _StreamRunRequest constructor (lines 198-200) falls back to this default:
self.user_id: Optional[str] = kwargs.get("user_id") or kwargs.get(
"userId", _DEFAULT_USER_ID
)
When Agentspace calls streaming_agent_run_with_events(request_json) (line 1166), the incoming JSON does not include a user_id or userId field. The authenticated user's identity — which Agentspace does know (confirmed by useriamprincipal in discoveryengine.googleapis.com audit logs) — is not passed through to the Agent Engine request payload.
This "default-user-id" then propagates through the entire ADK stack:
_StreamRunRequest.user_id ("default-user-id")
→ Runner.run_async(user_id=...)
→ Session.user_id
→ InvocationContext.user_id
→ BigQueryAgentAnalyticsPlugin logs it to BQ
Expected behavior
When a user accesses an agent through Agentspace, the user_id field in the request should contain the authenticated user's identity (IAM principal or email). The identity is already available in the Agentspace request context — it just needs to be included in the streaming_agent_run_with_events request JSON.
Possible fixes
- Agentspace side: Include the authenticated user's identity in the
user_idfield of the request JSON sent to Agent Engine - Vertex AI SDK side: In
streaming_agent_run_with_events()or_StreamRunRequest, extract user identity from HTTP request headers or IAM metadata as a fallback, rather than using a hardcoded"default-user-id"
Impact
- All ADK agents deployed to Agentspace are affected
BigQueryAgentAnalyticsPluginlogs"default-user-id"for all events, breaking per-user analytics (token usage, session counts, agent adoption)- Any downstream system relying on
session.user_idgets the placeholder value
Related
- Originally reported as google/adk-python#5189 — closed with a pointer to this issue since the root cause is in the Vertex AI SDK, not in ADK
- Lenguaje dominante
- Python
- Estrellas
- 907
- Forks
- 467
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 40
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de googleapis/python-aiplatform
-
Protobuf 7.35.1+ support Abiertoapi: vertex-ai
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
googleapis/python-aiplatform#7132 ·
-
api: vertex-ai
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
googleapis/python-aiplatform#7097 ·
-
CustomContainerTrainingJob.run drops max_wait_duration=0 instead of requesting indefinite DWS wait Abiertoapi: vertex-ai
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
googleapis/python-aiplatform#7067 · 1 comentario ·
-
api: vertex-ai
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
googleapis/python-aiplatform#6877 ·
-
api: vertex-ai
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
googleapis/python-aiplatform#6865 · 1 comentario ·
Todos los issues de googleapis/python-aiplatform
Issues similares
-
bug confirmed issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
open-webui/open-webui#30750 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100