Agent Engine

Agent Engine on Google Cloud is the managed Vertex AI/Agent Platform runtime for deploying, running, streaming, tracing, evaluating, and cleaning up AI agents built with frameworks such as ADK, LangChain, LangGraph, CrewAI, AG2, A2A, and MCP. The notebooks also use Agent Engine as the container for managed Sessions and Memory Bank resources that preserve conversation state and long-term user memories. · Official docs

Synthesized across 49 notebooks. See the source pages under Notebooks below for line-level grounding.

Agent Engine is the deployment and operations layer for agents: you build and test an agent locally, wrap or package it for the supported framework, deploy it with explicit dependencies and staging artifacts, then query it through SDK, HTTP, streaming, or framework-specific interfaces.

Most examples pair Agent Engine with managed state services. Vertex AI Session Service stores durable conversation history, while Memory Bank extracts meaningful long-term facts scoped by user_id or other scopes; agents retrieve those facts with Memory Bank services, semantic search, or preload tools.

The advanced notebooks extend the same pattern to custom containers, bidirectional Live API audio, code execution sandboxes, Cloud API Registry, MCP tools, A2A multi-agent systems, tracing, and Gen AI Evaluation. Across all variants, local testing, explicit configuration, IAM/API setup, runtime packaging, observability, and cleanup are recurring concerns.

Canonical workflow

  1. Enable the required Google Cloud APIs, configure PROJECT_ID, LOCATION, authentication, IAM roles, and any staging bucket or external credentials.
  2. Build the agent locally with the chosen framework, test individual tools first, then test the complete local agent or runner before deployment.
  3. Add state and memory deliberately: use managed sessions for durable chat history, Memory Bank scopes such as user_id for long-term memory, and retrieval or preload tools when the agent needs prior context.
  4. Package the deployment with explicit requirements, source packages, root_agent.py or entrypoint objects, build options, Dockerfile, Terraform artifacts, or ModuleAgent configuration as required by the framework.
  5. Deploy to Agent Engine, Agent Runtime, Express Mode, Cloud Run, GKE, or Terraform-managed infrastructure, using staging buckets and reproducible configuration.
  6. Create sessions or tasks for remote interactions, then query with SDK, REST, streaming, WebSocket, A2A, or direct HTTP clients as appropriate.
  7. Observe and validate behavior with traces, logs, task polling, session events, memory retrieval, sandbox outputs, and Gen AI Evaluation datasets or metrics.
  8. Delete deployed agents, sandboxes, staging buckets, experiments, Cloud Run/GKE/Cloud SQL resources, and Memory Bank resources when finished to avoid ongoing charges.

Best practices

See Agent Engine - Best Practices for the full distilled guide.

  • Test tools directly before wiring them into an agent, and test the full agent locally before deploying to Agent Engine.
  • Keep deployable agent objects serializable: keep init lightweight and pickle-able, move heavy initialization to set_up, and use lazy initialization when executors or tools have non-pickleable state.
  • Wrap ADK agents with AdkApp for Agent Engine deployment and provide session_service, memory_service, and memory tools on the Runner or Agent when using managed state.
  • Use stable scopes such as user_id for Memory Bank so memories are isolated per user, client, or domain entity.
  • Generate memories from complete sessions or recent events, then retrieve them with scope-based lookup for small profiles or semantic search/top_k for targeted recall.
  • Use custom Memory Bank topics only after establishing a default baseline; keep topics focused, provide detailed descriptions with exclusions, and use realistic few-shot examples.

Key models & APIs

  • Vertex AI Agent Engine / Agent Runtime, Agent Platform API, Vertex AI API, Vertex AI SDK: google-cloud-aiplatform with agent_engines, adk, and langchain extras, Google ADK: Agent, Runner, AdkApp, VertexAiSessionService, VertexAiMemoryBankService, PreloadMemoryTool, Vertex AI Session Service, Vertex AI Memory Bank, Agent Engine Sandbox and AgentEngineSandboxCodeExecutor, Gemini models including gemini-2.5-flash, gemini-2.0-flash, gemini-2.0-flash-live-preview-04-09, gemini-live-2.5-flash-native-audio, gemini-3.5-flash, gemini-3.1-pro-preview, and gemini-3.1-flash-lite, Embedding models including text-embedding-005 and gemini-embedding-001, Claude models on Vertex AI including claude-sonnet-4@20250514 and vertex_ai/claude-sonnet-4-5@20250929, Llama model on Vertex AI Model Garden/MaaS: vertex_ai/meta/llama-3.3-70b-instruct-maas, A2A SDK and Agent Cards / AgentSkill, MCP, Cloud API Registry, and MCP Toolbox for Databases, Gen AI Evaluation / EvalTask / AgentInfo, Cloud Trace, OpenInference, and Phoenix tracing, Cloud Storage staging buckets, Artifact Registry, Cloud Build, Cloud Run, GKE, Cloud SQL, Secret Manager, BigQuery, Vertex AI Search, and Managed Agents REST APIs

Notebooks (49)

Agents & ADK (21)

Gemini (23)

Open Models (1)

Vertex AI Search (4)


Part of the Generative AI Google Brain · Agent Engine - Best Practices