/alloydb:alloydb-agent-mode-quickstartfrom alloydb
Provisions AlloyDB agent pools over Private Service Connect and deploys AI data agents or multi-agent swarms on Vertex AI Agent Engine and Gemini Enterprise.
Ships in alloydb. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Enables an agent pool on an existing or newly created AlloyDB cluster, then
deploys a running agent that answers questions against that read-only pool:
either a single agent, or a swarm of parallel investigators with isolated
per-session PostgreSQL scratch databases. The user does not need to write a
config file by hand—ask for any missing settings and generate
./<name>.alloydb-agent.yaml in the current working directory to drive the
deployment scripts.
Ask which capability the user wants, then run only its steps:
gcloud + optional AlloyDB MCP, no
config file): enables agent mode on an existing AlloyDB cluster, or
creates a new AlloyDB cluster with agent mode enabled, creates a dedicated
VPC/subnet, and provisions an AGENT_POOL instance reachable over PSC.<name>_agent) querying
the pool over MCP (get_schema, execute_sql_read_only) and optionally
publishes it to Gemini Enterprise.agent_engine.agent.workspace: true) plus a
coordinator (<name>_swarm_coordinator, via agent_engine.coordinator)
that fans questions across parallel worker sessions.Key rules across capabilities:
READY. Run capability 1 (Step P) first unless the user already has one.gcloud: Where both this plugin's
alloydb-postgres MCP server and gcloud work—such as inspecting existing
clusters, instances, settings, or users (list_clusters, get_cluster,
list_instances, get_instance, list_pg_settings, list_users),
reusing configured ALLOYDB_POSTGRES_* settings after user confirmation, or
loading small SQL schemas/data (execute_sql, list_tables) when the
instance is network-reachable—prefer MCP when configured, and let the user
know MCP is an option. Because MCP in the plugin may or may not be
configured yet (or may not reach a PSC-only instance from outside its VPC),
note briefly if MCP is unconfigured and fall back directly to gcloud.
Agent Mode flags (--enable-agent-mode, AGENT_POOL,
agentPoolInfo.dnsName), VPC/PSC networking, --database-flags updates,
and Cloud Storage clusters import always require gcloud../<name>.alloydb-agent.yaml): Generate and
maintain ./<name>.alloydb-agent.yaml in the current working directory
(alongside ./.venv). Two orthogonal knobs under agent_engine control the
deployed topology:
agent.workspace: true | false — controls whether Step 2 deploys the
Cloud Run Agent Workspace (alloydb-agent-workspace-<name>) to give
each session a private writable PostgreSQL scratch database.coordinator (optional block) — controls whether Step 3 deploys the
Swarm Coordinator (<name>_swarm_coordinator) and Step 5 registers the
coordinator instead of the single agent in Gemini Enterprise../<name>.alloydb-agent.yaml
and re-running Steps 2–5. For updates and reverse-order teardown, see
references/updates_and_teardown.md.
Read it before deleting anything. To delete one deployment, run
deploy_agent.py teardown --config <config_path>: it only lists what it
would delete. Show that list, end your turn, and re-run with --yes only
after the user confirms, even when they already asked for the teardown.Working directory and <skill> path. Run Steps 0–5 from a consistent
working directory (where bootstrap_env.sh creates ./.venv), replacing
<skill> in commands below with the path to this skill directory. All cloud
resources are namespaced by <name> so multiple deployments in one project
never collide.
Each step is a task node that provisions or verifies cloud resources. Follow these execution rules across the graph:
Takes) before running the command.AGENT_SA, AGENT_WORKSPACE_URL, Agent Engine resource
names).Skip if the user already has a
READYagent pool. Put its cluster, pool instance, and database intodatabasein./<name>.alloydb-agent.yamland start at Step 0.
Goal: Enable agent mode on the user's AlloyDB cluster and provision a
dedicated VPC, subnet, service connection policy, and AGENT_POOL instance
reachable over PSC.
<project_id>, <region>, <cluster>, <primary> and its
size, <pool>, <vpc>, <subnet>, and the initial postgres password (if
new cluster) (collect in one message)READY agent pool with agentPoolInfo.dnsName, plus the
project_id, region, vpc, and database values for
./<name>.alloydb-agent.yamlPrerequisites: permissions to create AlloyDB clusters/instances, VPCs, and
service connection policies in <project_id>.
Guidance: Follow
references/agent_pool_setup.md step by step
(using AlloyDB MCP tools when configured for inspection/SQL, and gcloud for
agent-mode, PSC networking, and fallback operations), confirming each command's
output before running the next.
Rules:
dns.googleapis.com → create VPC, subnet, and
service connection policy → wait for cluster agentModeInfo.state: ACTIVE →
create the AGENT_POOL instance. Out-of-order creation leaves the pool's
private DNS zone unprovisioned.postgres database is enough for
pool setup and Step 4 (deploy_agent.py validate).Goal: Verify local CLI prerequisites (python3 3.11+, gcloud, user auth,
and ADC auth) and initialize ./.venv in the working directory.
./.venv with pinned runtime and deployment packagesPrerequisites: required settings for Step 1 collected from the user (or from Step P); run from the working directory you will use for Steps 1–5.
Guidance: Run bootstrap_env.sh once per working directory:
"<skill>"/scripts/bootstrap_env.sh
Rules:
gcloud auth login or gcloud auth application-default login; never run them yourself (they need the user's browser).Goal: Collect any missing settings from the user, generate
./<name>.alloydb-agent.yaml in the current working directory from the
template, and validate all fields and topology settings offline.
<config_path> (./<name>.alloydb-agent.yaml) in the current working
directory for Steps 2–5 and teardown==> Topology: ... and ==> Valid., or a list of errors to fixPrerequisites: Step 0 passed.
Guidance:
<project_id>, <region>, database
(cluster, instance pool ID, database name), and vpc (network,
subnet, and network_attachment—or offer defaults agents-vpc,
agents-subnet, agents-psc-attachment<name_suffix>).name (otherwise
derive <db>-agent or <db>-swarm with _ replaced by -, lowercase
alphanumeric and hyphens only, truncated to <=24 chars), name_suffix
(for shared foundation isolation), domain context, and
gemini_enterprise.app_id.agent_engine.agent.display_name
(and coordinator.display_name when deploying a swarm) from name, set
agent_engine.agent.workspace (false for simple agent, true for
swarm), and include agent_engine.coordinator only when deploying a
swarm../<name>.alloydb-agent.yaml in the current working directory
(modeled on "<skill>"/assets/example.alloydb-agent.yaml) and run
validate_config.py:.venv/bin/python "<skill>"/scripts/validate_config.py --config <config_path>
Check the printed topology line before continuing:
agent_workspace=NO vs. agent_workspace=yes (per-session scratch databases) reflects agent_engine.agent.workspace.coordinator=NO (single agent) vs. coordinator=yes (swarm coordinator)
reflects whether agent_engine.coordinator is present.Rules:
0. Fix <config_path>
directly—never edit generated Terraform or bundle files../<name>.alloydb-agent.yaml and briefly
explain what Steps 2–5 will provision and how long they take before starting
Step 2.agent_engine.agent.display_name must not contain "Coordinator";
agent_engine.coordinator.display_name (when set) should contain
"Coordinator".Goal: Provision the shared project networking/storage foundation, the
per-deployment service account and AlloyDB IAM user, and (when
agent_engine.agent.workspace: true) the Cloud Run Agent Workspace service.
<config_path>AGENT_SA
(agent-<name>@<project_id>.iam.gserviceaccount.com), AlloyDB IAM user
(agent-<name>@<project_id>.iam), and (when workspace: true)
AGENT_WORKSPACE_URL for alloydb-agent-workspace-<name>Prerequisites: Step 1 passed; permissions to enable APIs, manage IAM, and
run Infrastructure Manager in <project_id>.
Guidance: Run deploy_infra.py (idempotent):
.venv/bin/python "<skill>"/scripts/deploy_infra.py --config <config_path>
It provisions two Infrastructure Manager stacks (creating only missing resources
and leaving pre-existing ones untouched), plus the read-only IAM_BASED AlloyDB
database user (agent-<name>@<project_id>.iam) on database.cluster:
alloydb-agent-project<name_suffix>): APIs,
VPC/subnet, PSC endpoint, private *.run.app DNS, network attachment,
service-agent IAM, staging bucket, and Artifact Registry repo.alloydb-agent-<name>): AGENT_SA + IAM roles,
and (when agent_engine.agent.workspace: true) the
alloydb-agent-workspace-<name> Cloud Run service.Rules:
agent_engine.agent.workspace: true, verify isolation-self-check: PASS in Cloud Run logs on first deploy (gcloud run services logs read alloydb-agent-workspace-<name> --project=<project_id> --region=<region> --limit=50).Goal: Package and deploy the ADK agent runtime(s) to Vertex AI Agent Engine with PSC egress and MCP toolsets wired.
<config_path> (auto-resolves the Agent Pool DNS
name and, when workspace: true, the Cloud Run AGENT_WORKSPACE_URL)projects/<project_id>/locations/<region>/reasoningEngines/<engine_id>):
<name>_agent, plus <name>_swarm_coordinator when
agent_engine.coordinator is configuredcoordinator is also
configuredPrerequisites: Step 2 passed.
Guidance: Run deploy_agent.py deploy (idempotent—updates existing engines
for <name> in place):
.venv/bin/python "<skill>"/scripts/deploy_agent.py deploy --config <config_path>
Rules:
Goal: Run a live validation turn against <name>_agent to verify end-to-end
MCP connectivity and tool execution.
<config_path> with Step 3 deployedVALIDATE PASS: ... (exit 0) or diagnostic failure (exit 1)Prerequisites: Step 3 passed.
Guidance: Run deploy_agent.py validate:
.venv/bin/python "<skill>"/scripts/deploy_agent.py validate --config <config_path>
If validation fails, consult references/troubleshooting.md.
Rules:
deploy_agent.py validate exits 0
(VALIDATE PASS); never claim success on a validation failure or script
error.Skip / No-op if
gemini_enterprise.app_idis empty or omitted.
Goal: Register the deployed agent into the user's Gemini Enterprise app and
share it with all app users (sharingConfig.scope: ALL_USERS).
<config_path> with gemini_enterprise.app_id setALL_USERS
(registers <name>_swarm_coordinator when agent_engine.coordinator is
configured, otherwise <name>_agent)Prerequisites: Step 4 passed; a Gemini Enterprise app in the global
location; caller holds Gemini Enterprise Admin and Discovery Engine Admin roles.
Guidance: Run deploy_agent.py register (idempotent—creates or patches the
registration in place; no-op if gemini_enterprise.app_id is empty):
.venv/bin/python "<skill>"/scripts/deploy_agent.py register --config <config_path>
See references/swarm_coordinator.md for Gemini Enterprise prerequisites, licensing notes, and chat test prompts.
Rules:
gemini_enterprise.app_id is set, confirm the output reports shared with: ALL_USERS.gemini_enterprise.description in terms of what questions the agent
can answer (Gemini Enterprise uses this description for query routing).AGENT_POOL instance../<name>.alloydb-agent.yaml and tearing down per-deployment stacks,
project foundation, and AlloyDB pools cleanly.assets/agent_engine/agent.py (opens in a new tab)assets/agent_engine/coordinator.py (opens in a new tab)assets/agent_engine/utility.py (opens in a new tab)assets/agent_workspace/database/provisioner.sql (opens in a new tab)assets/agent_workspace/service/Dockerfile (opens in a new tab)assets/agent_workspace/service/requirements.txt (opens in a new tab)assets/agent_workspace/service/server.py (opens in a new tab)assets/example.alloydb-agent.yaml (opens in a new tab)assets/terraform/project/main.tf (opens in a new tab)assets/terraform/project/outputs.tf (opens in a new tab)assets/terraform/project/variables.tf (opens in a new tab)assets/terraform/workspace/main.tf (opens in a new tab)assets/terraform/workspace/outputs.tf (opens in a new tab)assets/terraform/workspace/variables.tf (opens in a new tab)references/agent_pool_setup.md (opens in a new tab)references/swarm_coordinator.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)references/updates_and_teardown.md (opens in a new tab)scripts/bootstrap_env.sh (opens in a new tab)scripts/deploy_agent.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub googlecloudplatform/alloydb-plugin --plugin alloydb