Skip to content

Add Vertex AI Agent Engine operators (Create, Get, Query, Update, Delete)#68479

Merged
shahar1 merged 40 commits into
apache:mainfrom
AlejandroMorgante:add-vertex-ai-agent-engine-operators
Jul 11, 2026
Merged

Add Vertex AI Agent Engine operators (Create, Get, Query, Update, Delete)#68479
shahar1 merged 40 commits into
apache:mainfrom
AlejandroMorgante:add-vertex-ai-agent-engine-operators

Conversation

@AlejandroMorgante

@AlejandroMorgante AlejandroMorgante commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Add a hook, operators, deferrable trigger support, unit tests, docs, and a system test for the Vertex AI Agent Engine (Reasoning Engine) API.

Operators

  • CreateAgentEngineOperator - creates a new Agent Engine resource.
  • GetAgentEngineOperator - retrieves an existing Agent Engine.
  • RunQueryJobOperator - starts a query job using the public run_query_job SDK method and can wait for completion, including deferrable mode.
  • UpdateAgentEngineOperator - updates an Agent Engine.
  • DeleteAgentEngineOperator - deletes an Agent Engine, with optional wait support.

Review-driven changes

This PR was updated based on review feedback to avoid relying on private SDK helpers and to keep the Airflow task semantics explicit:

  • Replaced the previous direct/private query path with the public run_query_job API.
  • Added RunQueryJobOperator support for waiting on query jobs and retrieving query output through check_query_job.
  • Added AgentEngineQueryJobTrigger for deferrable query-job waiting.
  • Updated delete waiting to follow the delete operation result instead of polling the Agent Engine resource until a 404.
  • Removed the deleted-resource polling helper that was no longer needed.
  • Made the system test self-contained: it builds the agent container image with Cloud Build, pushes it to an Artifact Registry repository scoped to the test run, creates the query-output GCS bucket, and deletes those resources during teardown.

Changes

  • providers/google/cloud/hooks/vertex_ai/agent_engine.py - new Agent Engine hook methods.
  • providers/google/cloud/operators/vertex_ai/agent_engine.py - new Agent Engine operators.
  • providers/google/cloud/triggers/vertex_ai.py - Agent Engine query-job trigger.
  • providers/google/provider.yaml - hook and operator registration.
  • providers/google/get_provider_info.py - matching provider metadata registration.
  • providers/google/docs/operators/cloud/vertex_ai.rst - Agent Engine operator docs.
  • providers/google/tests/system/google/cloud/vertex_ai/example_vertex_ai_agent_engine.py - self-contained Agent Engine lifecycle system test.
  • Unit tests for hook, operators, and triggers.

Validation

Validated end-to-end against a real GCP environment, including create, get, query-job submission, query-job output retrieval, update, and delete flows.

The complete system test can be reproduced from the Airflow checkout with GCP credentials forwarded to Breeze, SYSTEM_TESTS_GCP_PROJECT configured in files/airflow-breeze-config/environment_variables.env, and a unique environment ID:

SYSTEM_TESTS_ENV_ID=<unique-id> \
BREEZE_INIT_COMMAND='export GOOGLE_CLOUD_PROJECT="${SYSTEM_TESTS_GCP_PROJECT}"' \
breeze testing system-tests \
  --forward-credentials \
  --test-timeout 2400 \
  providers/google/tests/system/google/cloud/vertex_ai/example_vertex_ai_agent_engine.py \
  -q

Latest result: 1 passed in 763.87s. The run exercised both synchronous and deferrable query jobs and completed resource teardown successfully.

The latest system test version builds its own agent container and creates its own query-output bucket. It still requires the one-time project setup documented in the system test docstring: enabling Cloud Build and Artifact Registry APIs, granting the Agent Engine service agent access to pull the image and write query output, and ensuring the Cloud Build service account can manage the test Artifact Registry repository.

Real GCP validation screenshots and per-operator logs are attached in the review thread.


Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code (Sonnet 4.6) and Codex (GPT-5)

Generated-by: Claude Code (Sonnet 4.6) and Codex (GPT-5) following the guidelines

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a large PR so I could only get through part of the diff in one sitting. I have left some comment for you to address.

Comment thread providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py Outdated

@MaksYermak MaksYermak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlejandroMorgante could you please provider a screenshot from Airflow UI that the new example_vertex_ai_agent_engine.py system test pass successfully?

@AlejandroMorgante

Copy link
Copy Markdown
Contributor Author

@AlejandroMorgante could you please provider a screenshot from Airflow UI that the new example_vertex_ai_agent_engine.py system test pass successfully?

Sure. I validated the same operator lifecycle end-to-end in a real Airflow environment using this DAG:

AlejandroMorgante/agentic-airflow-demo@bedf76b

It exercises:

  • CreateAgentEngineOperator
  • GetAgentEngineOperator
  • QueryAgentEngineOperator
  • UpdateAgentEngineOperator
  • DeleteAgentEngineOperator

All tasks completed successfully:

image

The DAG uses my real Agent Engine container, so the query payload is adapted to that runtime, but the operator lifecycle is the same as in example_vertex_ai_agent_engine.py.

Comment thread generated/provider_dependencies.json.sha256sum Outdated
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

uv.lock on main just moved via #68642 ("Prepare provider documentation 2026-06-16"), commit 0236c57 and this PR currently conflicts.

Quickest fix:

git fetch upstream main && git rebase upstream/main
rm uv.lock && uv lock
git add uv.lock && git rebase --continue
git push --force-with-lease

Automated nudge — ignore if you're not ready to rebase. This comment is updated in place on future uv.lock bumps.

@AlejandroMorgante
AlejandroMorgante force-pushed the add-vertex-ai-agent-engine-operators branch 2 times, most recently from 962d3b2 to d13b01f Compare June 18, 2026 23:42
@AlejandroMorgante
AlejandroMorgante force-pushed the add-vertex-ai-agent-engine-operators branch from 8473b09 to 3917f29 Compare June 19, 2026 20:08

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left some more comments.

Comment thread providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py Outdated
Comment thread providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py Outdated
Comment thread providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py Outdated
Comment thread providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py Outdated
@AlejandroMorgante
AlejandroMorgante force-pushed the add-vertex-ai-agent-engine-operators branch from e62e21c to ad80e73 Compare June 20, 2026 22:23
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 22, 2026
@AlejandroMorgante
AlejandroMorgante force-pushed the add-vertex-ai-agent-engine-operators branch from ad80e73 to 70ede63 Compare June 22, 2026 19:41
@AlejandroMorgante
AlejandroMorgante marked this pull request as draft June 24, 2026 14:20
@AlejandroMorgante
AlejandroMorgante marked this pull request as ready for review June 24, 2026 14:20

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending green CI.

Comment thread providers/google/tests/unit/google/cloud/operators/vertex_ai/test_agent_engine.py Outdated

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, last comments to handle from my prespective.
Please take a final look at all files to see that it's good to ship.

Introduces CheckQueryAgentEngineOperator (with deferrable support via
AgentEngineQueryJobTrigger) to poll the status of a batch query job
started by QueryAgentEngineOperator.

Switches QueryAgentEngineOperator from a custom REST call to the SDK's
public run_query_job() method, and removes the now-unused internal
polling helpers.
… Engine

- Move _serialize_value from operators and triggers into the hook module
  so both import from a single source of truth
- Warn on unknown query job status values in wait_for_query_agent_engine_job
  to surface unexpected API responses instead of silently looping
- Add round-trip serialize test for AgentEngineQueryJobTrigger with a
  Pydantic model config to verify _serialize_value is applied on serialize()
The resources/agent_engine directory only contained a license-header
__init__.py and no actual resources, flagged in review.
The system test previously required the agent container image and the
query-output bucket to pre-exist in the test project. Review feedback
on the PR asked for the test to be atomic, so the image is now built
by Cloud Build from sources checked in under resources/agent_engine/
into an Artifact Registry repository scoped to the test run, and both
the repository and the bucket are created and deleted by the test
itself. Remaining project prerequisites (APIs and IAM for the Cloud
Build service account and the Agent Engine service agent) are
documented in the Dag docstring.
The prek hook that creates missing init files in test packages
generates this file, so CI static checks fail if it is not
committed.
@AlejandroMorgante
AlejandroMorgante force-pushed the add-vertex-ai-agent-engine-operators branch from 02a7adc to c3fae86 Compare July 11, 2026 14:07
@shahar1
shahar1 merged commit e714b1d into apache:main Jul 11, 2026
110 checks passed
joshuabvarghese pushed a commit to joshuabvarghese/airflow that referenced this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers kind:documentation provider:google Google (including GCP) related issues ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants