Skip to content

Inline source deployment incompatible with agent_server_mode: EXPERIMENTAL #4350

@ASRagab

Description

@ASRagab

Summary

When deploying an agent to Vertex AI Agent Engine using inline source deployment (source_packages, entrypoint_module, entrypoint_object) with agent_server_mode: EXPERIMENTAL, the deployment fails at runtime. The EXPERIMENTAL server runtime attempts to load the agent from a pickle file instead of using the inline source code.

Environment

  • google-cloud-aiplatform: 1.135.0
  • google-adk: latest
  • Python: 3.11/3.12
  • Region: us-central1

Steps to Reproduce

  1. Create an ADK agent with AdkApp
  2. Deploy using the GenAI SDK with inline source configuration:
client.agent_engines.create(config={
    "source_packages": ["my_agent_package", "requirements.txt"],
    "entrypoint_module": "runtime_wrapper",
    "entrypoint_object": "adk_app",
    "class_methods": [...],
    "agent_server_mode": vertexai_types.AgentServerMode.EXPERIMENTAL,
})
  1. Deployment completes but the agent fails to start

Expected Behavior

The agent should start successfully using the inline source code, similar to how it works without agent_server_mode: EXPERIMENTAL.

Actual Behavior

The agent fails with the following error in Cloud Logging:

FileNotFoundError: [Errno 2] No such file or directory: 'user_code/code.pkl'

Stack trace shows the EXPERIMENTAL server runtime expects a pickle file:

File "/code/server.py", line 61, in serve
    servicer = service_builder.construct_service(pickle_file)
File "/code/service_builder.py", line 349, in construct_service
    obj = utils.get_object(python_file_name)

Analysis

The issue appears to be that:

  1. Without EXPERIMENTAL mode: The server runtime correctly uses inline source (entrypoint_module + entrypoint_object)
  2. With EXPERIMENTAL mode: A different server runtime is used that only supports pickle-based deployment

Removing agent_server_mode: EXPERIMENTAL from the config allows the same agent to deploy and run successfully with inline source.

Questions

  1. Is this a known limitation of EXPERIMENTAL mode?
  2. Is there a timeline for inline source support in EXPERIMENTAL mode?
  3. Is pickle-based deployment currently the only supported method for bidirectional streaming agents?

Workaround

Currently, the only workaround is to use pickle-based deployment (with staging_bucket and agent= parameters) for agents requiring EXPERIMENTAL mode, which introduces complexity around GCS bucket management and pickle serialization compatibility.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent engine[Component] This issue is related to Vertex AI Agent Engine

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions