Skip to content

adk deploy agent_engine provisions engines without async-query support (:asyncQuery fails FAILED_PRECONDITION 'does not support AsyncQueryReasoningEngine API') #6220

Description

@maxgasztych

🔴 Required Information

Describe the Bug:

An Agent Engine deployed with adk deploy agent_engine is not provisioned
with the long-running query API
(reasoningEngines:asyncQuery, a.k.a.
AsyncQueryReasoningEngine / durable query jobs). The engine comes up and serves
synchronous traffic fine, but any call to the :asyncQuery REST endpoint is
rejected server-side with:

FAILED_PRECONDITION: The reasoning engine resource [...] does not support
AsyncQueryReasoningEngine API.

adk deploy should provision engines that support :asyncQuery. Today only the
programmatic vertexai.agent_engines.create(...) path yields an async-query-capable
engine; an engine created by adk deploy cannot be upgraded in place, so any agent
that relies on durable/long-running query jobs simply cannot be deployed via the
ADK CLI. Treating this as a bug rather than a missing feature: adk deploy is the
documented happy path and it silently produces an engine that's missing a
first-class Agent Engine capability.

Relevant code in src/google/adk/cli/cli_deploy.py (v2.2.0):

  • The agent_engine deploy path creates the engine with default config
    (client.agent_engines.create()), then client.agent_engines.update(...) with
    agent_config['class_methods'] = _AGENT_ENGINE_CLASS_METHODS.
  • _AGENT_ENGINE_CLASS_METHODS only registers methods with api_mode of
    '' (sync), async, stream, and async_stream. No method registers the
    long-running async-query/job API
    , and nothing in the deploy request opts the
    engine into the AsyncQueryReasoningEngine capability — so the provisioned
    engine never supports :asyncQuery.

Steps to Reproduce:

  1. Create a trivial agent package sample_agent/:

    sample_agent/__init__.py

    from . import agent

    sample_agent/agent.py

    from google.adk.agents import LlmAgent
    
    root_agent = LlmAgent(
        name="hello_agent",
        model="gemini-2.0-flash",
        instruction="Reply with exactly: 'hello from the sample agent'.",
    )

    sample_agent/requirements.txt

    google-adk==2.2.0
    # adk 2.2.0's generated container launches `adk api_server --a2a`, which
    # imports `a2a.server.apps` (only present in a2a-sdk 0.3.x; 1.x removed it).
    # Pin so the container actually starts and we can reach the asyncQuery test.
    a2a-sdk[http-server]==0.3.25
    
  2. Deploy with the ADK CLI:

    adk deploy agent_engine \
      --project=YOUR_PROJECT --region=us-central1 \
      --display_name=asyncquery_repro \
      sample_agent

    Note the created resource name, e.g.
    projects/.../locations/us-central1/reasoningEngines/ENGINE_ID.

  3. Confirm the engine is healthy — synchronous :query returns HTTP 200:

    ENGINE="projects/YOUR_PROJECT/locations/us-central1/reasoningEngines/ENGINE_ID"
    TOKEN=$(gcloud auth application-default print-access-token)
    curl -s -X POST \
      -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" \
      -H "x-goog-user-project: YOUR_PROJECT" \
      "https://us-central1-aiplatform.googleapis.com/v1beta1/${ENGINE}:query" \
      -d '{"classMethod":"async_create_session","input":{"user_id":"repro"}}' \
      -w "\nHTTP_STATUS:%{http_code}\n"
    # -> HTTP_STATUS:200, session created
  4. Call the long-running query API :asyncQuery on the same engine:

    BUCKET=your-gcs-bucket
    echo '{"class_method":"async_stream_query","input":{"user_id":"repro","message":"hi"}}' \
      > /tmp/asyncq_input.json
    gcloud storage cp /tmp/asyncq_input.json "gs://${BUCKET}/asyncq-repro/input.json"
    curl -s -X POST \
      -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" \
      -H "x-goog-user-project: YOUR_PROJECT" \
      "https://us-central1-aiplatform.googleapis.com/v1beta1/${ENGINE}:asyncQuery" \
      -d "{\"inputGcsUri\":\"gs://${BUCKET}/asyncq-repro/input.json\",\"outputGcsUri\":\"gs://${BUCKET}/asyncq-repro/out/\"}" \
      -w "\nHTTP_STATUS:%{http_code}\n"

Expected Behavior:

An engine provisioned by adk deploy agent_engine supports :asyncQuery, so the
durable/long-running query job is accepted (returns an LRO) — the same capability
you get from vertexai.agent_engines.create(...).

Observed Behavior:

:query works (HTTP 200), but :asyncQuery on the same engine fails:

{
  "error": {
    "code": 400,
    "message": "The reasoning engine resource [projects/.../reasoningEngines/ENGINE_ID] does not support AsyncQueryReasoningEngine API.",
    "status": "FAILED_PRECONDITION"
  }
}

Environment Details:

  • ADK Library Version (pip show google-adk): 2.2.0
  • Desktop OS: Linux
  • Python Version (python -V): 3.11

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-2.0-flash (irrelevant; this is a deploy/provisioning issue)

🟡 Optional Information

Suggested fix:
Have the adk deploy agent_engine path provision an async-query-capable engine —
e.g. register the long-running query method / set the capability in the
create/update request so the backing infrastructure for AsyncQueryReasoningEngine
(:asyncQuery) is wired up, matching what vertexai.agent_engines.create(...)
does. Ideally expose it as the default (or via a flag) so CLI-deployed agents can
run durable query jobs.

Note (separate, pre-existing blocker):
With google-adk==2.2.0, the generated Dockerfile launches adk api_server --a2a
but the generated requirements.txt only pins google-adk (no a2a-sdk). An
unconstrained a2a-sdk resolves to 1.x, which removed a2a.server.apps, so the
container crashes on startup with ModuleNotFoundError: No module named 'a2a.server.apps' before it can serve anything. Pinning a2a-sdk[http-server]==0.3.25
(as in the repro above) works around it so the asyncQuery behavior can be observed.

Metadata

Metadata

Assignees

Labels

agent engine[Component] This issue is related to Vertex AI Agent Engine

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions