Skip to content

Google Cloud Agent Platform express mode for ADK

Supported in ADKPython v0.1.0Java v0.1.0Preview

Google Cloud Agent Platform express mode provides a no-cost access tier for prototyping and development, allowing you to use Agent Platform services without creating a full Google Cloud Project. This service includes access to many powerful Agent Platform services, including:

You can sign up for an express mode account using a Gmail account and receive an API key to use with the ADK. Obtain an API key through the Google Cloud Console. For more information, see Agent Platform express mode.

Preview release

The Agent Platform express mode feature is a Preview release. For more information, see the launch stage descriptions.

Agent Platform express mode limitations

Agent Platform express mode projects are only valid for 90 days and only select services are available to be used with limited quota. For example, the number of Agent Runtime instances are restricted to 10 and deployment to Agent Runtime requires paid access. To remove the quota restrictions and use all of Agent Platform's services, add a billing account to your express mode project.

Configure Agent Runtime container

When using Agent Platform express mode, create an AgentEngine object to enable Agent Platform management of agent components such as Session and Memory objects. With this approach, Session objects are handled as children of the AgentEngine object. Before running your agent make sure your environment variables are set correctly, as shown below:

agent/.env
GOOGLE_GENAI_USE_VERTEXAI=TRUE
GOOGLE_API_KEY=PASTE_YOUR_ACTUAL_EXPRESS_MODE_API_KEY_HERE

Next, create your Agent Runtime instance using the Agent Platform SDK.

  1. Import Agent Platform SDK.

    import vertexai
    from vertexai import agent_engines
    
  2. Initialize the Agent Platform Client with your API key and create an agent engine instance.

    # Create Agent Runtime with Gen AI SDK
    client = vertexai.Client(
      api_key="YOUR_API_KEY",
    )
    
    agent_engine = client.agent_engines.create(
      config={
        "display_name": "Demo Agent Runtime",
        "description": "Agent Runtime for Session and Memory",
      })
    
  3. Get the Agent Runtime name and ID from the response to use with Memories and Sessions.

    APP_ID = agent_engine.api_resource.name.split('/')[-1]
    

Manage Sessions with VertexAiSessionService

VertexAiSessionService is compatible with Agent Platform Express Mode API Keys. You can instead initialize the session object without any project or location.

# Requires: pip install google-adk[vertexai]
# Plus environment variable setup:
# GOOGLE_GENAI_USE_VERTEXAI=TRUE
# GOOGLE_API_KEY=PASTE_YOUR_ACTUAL_EXPRESS_MODE_API_KEY_HERE
from google.adk.sessions import VertexAiSessionService

# The app_name used with this service should be the Reasoning Engine ID or name
APP_ID = "your-reasoning-engine-id"

# Project and location are not required when initializing with Agent Platform express mode
session_service = VertexAiSessionService(agent_engine_id=APP_ID)
# Use REASONING_ENGINE_APP_ID when calling service methods, e.g.:
# session = await session_service.create_session(app_name=APP_ID, user_id= ...)

Session Service Quotas

For Free express mode Projects, VertexAiSessionService has the following quota:

  • 10 Create, delete, or update Agent Runtime sessions per minute
  • 30 Append event to Agent Runtime sessions per minute

Manage Memory with VertexAiMemoryBankService

VertexAiMemoryBankService is compatible with Agent Platform express mode API Keys. You can instead initialize the memory object without any project or location.

# Requires: pip install google-adk[vertexai]
# Plus environment variable setup:
# GOOGLE_GENAI_USE_VERTEXAI=TRUE
# GOOGLE_API_KEY=PASTE_YOUR_ACTUAL_EXPRESS_MODE_API_KEY_HERE
from google.adk.memory import VertexAiMemoryBankService

# The app_name used with this service should be the Reasoning Engine ID or name
APP_ID = "your-reasoning-engine-id"

# Project and location are not required when initializing with express mode
memory_service = VertexAiMemoryBankService(agent_engine_id=APP_ID)
# Generate a memory from that session so the Agent can remember relevant details about the user
# memory = await memory_service.add_session_to_memory(session)

Memory Service Quotas

For Free express mode Projects, VertexAiMemoryBankService has the following quota:

  • 10 Create, delete, or update Agent Runtime memory resources per minute
  • 10 Get, list, or retrieve from Agent Runtime Memory Bank per minute

Code Sample: Weather Agent with Session and Memory

This code sample shows a weather agent that utilizes both VertexAiSessionService and VertexAiMemoryBankService for context management, allowing your agent to recall user preferences and conversations.