1.0 Workloads, Catalog & Gateways — Overview (Layer 5)¶
In the Overview, our support agent asked a simple question: "What is the status of order ORD-2026-4102?"
Before we look at the security checkpoints (Section 2) or the cloud landing zone beneath the floor (Section 3), Section 1 introduces the cast of workloads on stage (layer-5-workloads)—the agents, tool microservices, and private front door that collaborate to answer that question—and shows how a single declarative service catalog (catalog in env.yaml) wires them together without coupling the teams that build them.
1. Four Teams, One Seamless Conversation¶
Imagine how a traditional store processes Garimpo's order support request (ORD-2026-4102). A front-line support agent takes the customer's question, hands order-specific work to an operations specialist, and the specialist checks the store's internal systems: orders, customer accounts, refunds, and customer notifications.
Esmeralda mirrors that exact organizational structure in software. Instead of cramming every prompt, database credential, and API integration into one giant "Mega-Agent," Layer 5 splits the work across four independent tracks, each living in its own isolated GCP project:
| Track / Team | Role in Camila Rocha's Request | GCP Project | Layer 5 Units |
|---|---|---|---|
| CX Product Team | Owns the customer conversation. Builds the orchestrator agent (support-assistant, Google ADK) that greets the support agent and delegates specialized work. |
esm-<env>-cx-agents-<sfx> |
agents/support-assistant |
| AI CoE Team | Owns reusable domain intelligence. Builds the order operations specialist (order-ops-specialist), published over the Agent-to-Agent (A2A) protocol so any business unit can invoke it. |
esm-<env>-ai-coe-agents-<sfx> |
agents/order-ops-specialist |
| Backend / MCP Tools Team | Wraps core enterprise systems as standardized Model Context Protocol (MCP) microservices on private Cloud Run. | esm-<env>-mcps-<sfx> |
services/knowledge-base, services/orders, services/customers, services/refunds, services/notifications |
| Gateway / PlatformOps Team | Operates the private front door (entry point at *.esmeralda.internal), routing traffic via the built-in direct backend or optional adapters (envoy, apigee). |
esm-<env>-gateway-<sfx> |
entrypoint, gateways/direct, gateways/envoy |
The five sample MCP servers are routed through the Envoy gateway adapter on Cloud Run.
Neither agent team needs network peering or IAM admin rights in the other's project. Every call from an agent leaves through the Central Agent Gateway (Layer 4) and arrives at the target through the private entry point (*.esmeralda.internal):
flowchart TB
subgraph CX["CX Team Project (modules/5-workloads/agents/adk-agent)"]
Orch["support-assistant<br/>(Reasoning Engine, BYOC)"]
end
AGW["Central Agent Gateway<br/>(Governance Project, Layer 4)"]
subgraph Gateway["Gateway Project (modules/5-workloads/entrypoint + gateways/direct)"]
EP["Entry Point<br/>internal HTTPS LB<br/>*.esmeralda.internal"]
PSC["PSC NEG<br/>(region-aiplatform.googleapis.com)"]
Adapter["Optional Adapter<br/>(e.g. Envoy, off by default)"]
EP ==> PSC
EP -.-> Adapter
end
subgraph CoE["AI CoE Team Project (modules/5-workloads/agents/a2a-agent)"]
Spec["order-ops-specialist<br/>(Reasoning Engine, BYOC)"]
DB[(Cloud SQL Postgres)]
Spec -.-> DB
end
subgraph MCPServers["MCPs Project (modules/5-workloads/services/* + serverless NEGs)"]
M1["notifications"]
M2["orders"]
M3["customers"]
end
Orch ==>|"1. A2A: order-ops-specialist.esmeralda.internal"| AGW
Spec ==>|"2. MCP: #60;svc#62;.esmeralda.internal/mcp"| AGW
AGW ==> EP
PSC ==>|"Host + path rewrite, caller's access token"| Spec
EP ==>|"Serverless NEG, caller's ID token"| MCPServers
2. Why We Designed It This Way: Key Decisions & Trade-offs¶
Why separate orchestrators, specialists, MCP tools, and gateways into distinct Layer 5 units? Here is the summary of the architectural decisions behind Section 1:
| Decision | Why We Made It | What We Avoided |
|---|---|---|
| ADR-04: Standalone MCP Microservices Instead of In-Process Python Functions | Exposes every enterprise connector (knowledge-base, orders, customers, refunds, notifications) as an independent FastMCP service on Cloud Run that scales to zero and has its own IAM invoker list and Agent Registry entry. |
Redeploying and re-evaluating the entire AI agent every time a backend SQL query or API schema changes; granting the agent raw database credentials. |
| ADR-05: Multi-Agent Delegation (A2A) Over a Single Mega-Prompt | Splits customer conversation (support-assistant) from domain order operations (order-ops-specialist) using the open A2A protocol and published Agent Cards. |
Context-window pollution, inflated token costs, degraded tool-selection accuracy, and duplicate order and refund logic across multiple customer channels. |
| ADR-06: Automated VPC-Internal Database Bootstrapping | Provisions the specialist's private Cloud SQL PostgreSQL instance alongside an ephemeral VPC-bound Cloud Run Job (<agent>-db-bootstrap-<env>) that grants IAM database privileges automatically during deployment. |
Public database IPs, manual psql steps from developer laptops, or long-lived bastion VMs. |
Declarative Service Catalog (catalog in env.yaml) |
Defines every private host, its workload kind (mcp, a2a, adk), its credential type (id vs access), its health probe, and its authorized callers in one file. |
Scattering hostname mappings, IAM invoker bindings, and smoke-test scripts across dozens of unrelated Terraform files. |
3. How It Works & CLI in Practice¶
The Layer 5 Deployment Order¶
When you deploy Layer 5 (uv run esmeralda deploy --layer 5 --env dev, shortcut make deploy-workloads ENV=dev), the CLI applies every enabled unit one by one in the order derived from their Terragrunt dependency blocks, each through the destroy guard, and stops at the first failure. The order has six stages:
- AI Reasoning Engines (
agents/order-ops-specialist,agents/support-assistant) — Deploys the BYOC containers on Vertex AI Agent Runtime, binds them to the Layer 4 Central Agent Gateway, and registers the specialist'sA2A_AGENT_CARD. - MCP Tool Services (
services/{customers,orders,notifications}) — Deploys the private Cloud Run containers and registers theirTOOL_SPECschemas (tools.json) in the central Agent Registry. They come after the agents because they read each agent's identity forrun.invokerand their caller guard. - Gateway Backends (
gateways/directalways, plus any enabled adapter ingateways.enabledsuch asgateways/envoy) — Creates the serverless NEGs and Private Service Connect NEGs pointing at the deployed services and agent engine IDs. - Private Entry Point (
entrypoint) — Configures the internal HTTPS load balancer (*.esmeralda.internal) using the reserved IP and DNS zone from Layer 2 and the internal Root CA leaf certificate from Layer 3. - Verification Test VM (
test-vm) — Provisions the private IAP-tunneled runner VM used byuv run esmeralda verify(make test-gateway) to probe every catalog route from inside the Shared VPC. - IAP Egress Grants (
iap-egress, always last) — Registers the catalog's external (managed: false) targets in the Agent Registry and grantsroles/iap.egressoron each Agent Registry entry to the callers the catalog lists, so the agents' SPIFFE identities are authorized to egress through the Central Agent Gateway to exactly those destinations.
After the last unit, the deploy runs the running-image check (uv run esmeralda build --verify --env dev, skip it with --skip-verify-images).
Operating Layer 5 with the esmeralda CLI¶
You can inspect, test, build, deploy, and verify every Layer 5 workload directly from the CLI:
# List all Layer 5 units and live catalog routing
uv run esmeralda units --env dev
uv run esmeralda status --env dev
# Run Camila Rocha's order support query locally (--local-mcp starts and stops the local MCP servers)
uv run esmeralda query --agent-dir apps/agents/support-assistant --local-mcp \
"What is the status of order ORD-2026-4102?"
# Plan or apply a specific Layer 5 workload unit (with destroy-guard protection)
uv run esmeralda plan layer-5-workloads/services/orders --env dev
uv run esmeralda apply layer-5-workloads/services/orders --env dev
# Build and push one image, then deploy its unit
uv run esmeralda build orders-service
uv run esmeralda deploy services/orders --env dev
# Plan all of Layer 5 read-only, then deploy it
uv run esmeralda deploy --layer 5 --env dev --dry-run
uv run esmeralda deploy --layer 5 --env dev
# Verify all *.esmeralda.internal routes and run a live end-to-end orchestrator query
uv run esmeralda verify --env dev
Subsections in Section 1¶
Follow Camila Rocha's request through the five subsections of Section 1:
- 1.1 Two Teams, Two Agents — Orchestration vs. Specialization (ADK & A2A)
- Meet
support-assistant(Google ADK) andorder-ops-specialist(A2A). - Why they live in separate GCP projects, how BYOC on Vertex AI Agent Runtime works, and how the zero-bastion Cloud SQL task store is bootstrapped.
- 1.2 Wrapping Enterprise Systems as MCP Tool Servers
- Meet
knowledge-base,orders,customers,refunds, andnotificationson private Cloud Run. - How
tools.jsoncontracts register in the Agent Registry, how caller ID tokens flow end-to-end, and how developers test tools locally. - 1.3 The Private Front Door & Pluggable Gateways
- How the
*.esmeralda.internalentry point routes traffic with the built-indirectbackend (zero extra proxy VMs). - How teams can plug in Envoy or Apigee X via
gatewaysinenv.yamland migrate hosts one at a time without touching agent code. - 1.4 Partner API Management & Token Monetization with Apigee X
- Step-by-step walkthrough of how Apigee X (
partner.esmeralda.internal, served on the entry point) exposes curated agents (partner-agents) and MCP tools (partner-mcp) to external B2B partners. - How
VerifyAPIKey, KVM allowlists, two-phase<LLMTokenQuota>(EnforceOnly+ SSEEventFlowCountOnly), andPostClientFlowanalytics work end-to-end with GEAP Agent Identity and the Central Agent Gateway. - 1.5 One Gateway per Hop
- Which gateway handles each hop by default (entry point, Central Agent Gateway, Apigee X, Envoy, API Gateway model routing), and when to choose an alternative.
Tip
Curious how the outbound Central Agent Gateway verifies SPIFFE identities and private TLS certificates on every hop? After finishing Section 1, head to 2.1 Central Agent Gateway & Private PKI.