Vertex AI Agent Engine: reasoning engine with secret-backed env vars (secret_env) deploys but has zero running instances
@maxgasztych ci sta già lavorando.
Dal 18/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Environment details
- OS type and version: managed Agent Engine runtime (deployed from macOS)
- Python version: 3.11 (runtime
python_spec.version=3.11; reproduced on the 3.11 deploy path) google-cloud-aiplatformversion: 1.156.0- Region: us-central1
Summary
Deploying a reasoning engine (Agent Engine) whose deployment_spec contains secret-backed environment variables — secret_env (Terraform) / env_vars with a {"secret": SECRET_ID, "version": ...} value (SDK) — creates the engine successfully (done: true, no error) but it never starts any running instances. stream_query then fails with:
FAILED_PRECONDITION: ... does not have running instances. It's likely that it does
not have a valid 'spec.package_spec' configuration.
An identical deployment with the same value passed as a plain env var (no secret reference) starts instances and serves normally. The only difference between "works" and "0 instances" is the presence of secretEnv in the deploymentSpec.
Steps to reproduce
- Create a Secret Manager secret in the same project (one enabled version).
- Grant
roles/secretmanager.secretAccessoron it to the runtime service account (and, per the docs, to the Vertex AI Service Agentservice-PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.comand the Reasoning Engine Service Agentservice-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com). - Deploy an agent with a secret-backed env var (code below).
- Wait for the create LRO to finish — it succeeds (
done: true, noerror). - Call
stream_query→FAILED_PRECONDITION ... does not have running instances. - Deploy the same agent with the value as a plain env var instead → instances start and it serves.
Code example
import vertexai
from vertexai import agent_engines
vertexai.init(project="PROJECT", location="us-central1",
staging_bucket="gs://STAGING_BUCKET")
# `app` is any AdkApp / custom ReasoningEngine. The trigger is purely the
# secret-backed env var, not the agent code.
# CONTROL — starts running instances, serves fine:
agent_engines.create(app, requirements=[...], display_name="control")
# REPRO — created successfully, but 0 running instances:
agent_engines.create(
app, requirements=[...], display_name="repro-secret",
env_vars={"MY_SECRET": {"secret": "my-secret", "version": "latest"}},
)
Stack trace (stream_query against the secret_env engine)
google.api_core.exceptions.FailedPrecondition: 400 The requested resource
[projects/.../locations/us-central1/reasoningEngines/...] does not have running
instances. It's likely that it does not have a valid 'spec.package_spec'
configuration. Please update the resource with a valid 'spec.package_spec' and
then try again.
Diagnosis already performed (rules out the usual causes)
With Secret Manager DATA_READ audit logging enabled and a controlled A/B/C bisect of otherwise-identical engines:
- The secret value is read successfully at instance startup by the runtime service account (
AccessSecretVersion,code=OK, zero denials). - The application starts normally — runtime logs show
Started server process,Application startup complete,Uvicorn running on http://0.0.0.0:8080. The only anomaly is that the platform never marks the instance "running", and no request/health-probe logs follow startup. - Independent of IAM grants: reproduced with
secretAccessorgranted to the runtime SA, the Reasoning Engine Service Agent (gcp-sa-aiplatform-re), and the Vertex AI Service Agent (gcp-sa-aiplatform) — all three, fully propagated → still 0 instances. Audit logs show only the runtime SA ever reads the secret; the platform service agents never attempt a read. - Independent of secret version format:
"latest"and a pinned numeric version both fail identically. - Independent of Python version (3.11) and deploy tool (reproduced via both the
vertexaiSDK and Terraform'sgoogle_vertex_ai_reasoning_enginesecret_env). - The control (same engine, value as a plain env var) → running instances.
Expected: a reasoning engine with secret-backed env vars should start instances, since the secret is readable and the app boots.
Actual: zero running instances wheneversecretEnvis present in thedeployment_spec, regardless of IAM/version/Python/tooling.
Related: #5647 — same surface symptom (secret-backed env vars in Agent Engine), but that report was resolved via the custom-service-account / secretAccessor IAM fix. This issue is distinct: the IAM fix is explicitly ruled out above (secret is read OK by the runtime SA; granting all relevant service agents still yields 0 instances).
- Lingua principale
- Python
- Stelle
- 907
- Fork
- 467
- Merge medio
- 1g 13h
- PR unite (30g)
- 44
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di googleapis/python-aiplatform
-
Protobuf 7.35.1+ support Apertaapi: vertex-ai
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
googleapis/python-aiplatform#7132 ·
-
api: vertex-ai
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleapis/python-aiplatform#7097 · 1 commento ·
-
CustomContainerTrainingJob.run drops max_wait_duration=0 instead of requesting indefinite DWS wait Apertaapi: vertex-ai
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleapis/python-aiplatform#7067 · 1 commento ·
-
api: vertex-ai
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
googleapis/python-aiplatform#6877 ·
-
api: vertex-ai
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
googleapis/python-aiplatform#6865 · 1 commento ·
Tutte le issue di googleapis/python-aiplatform
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-connect#1057 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
open-telemetry/sig-end-user#406 ·
-
bug ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100