Skip to content

Production-ready deployment solution for Google ADK Agents to Vertex AI Agent Engine. Fixes the critical CLI bug (ModuleNotFoundError: agent_engine_app) with programmatic deployment templates. Includes comprehensive guide.

License

Notifications You must be signed in to change notification settings

Acquarts/adk-agent-engine-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ADK Agent Engine Deployment

Production-ready deployment solution for Google ADK Agents to Vertex AI Agent Engine

Python License


🎯 The Problem

The ADK CLI adk deploy agent_engine has a critical bug that causes deployments to fail with:

ModuleNotFoundError: No module named 'agent_engine_app'

This repository provides the solution.


βœ… The Solution

This toolkit provides programmatic deployment templates that bypass CLI bugs and ensure reliable deployments every time.

Why This Works

CLI Approach ❌ Programmatic Approach βœ…
Creates temporary files with import bugs Uses Python API directly
Implicit package handling Explicit extra_packages control
Runs problematic absolufy-imports Avoids intermediate steps
Limited error handling Comprehensive error handling

πŸš€ Quick Start

1. Copy Templates to Your Project

# Templates
cp templates/deploy_agent.py your_project/
cp templates/test_agent.py your_project/

2. Configure and Deploy

# Edit deploy_agent.py
PROJECT_ID = "your-project-id"
AGENT_FOLDER = "your_agent_folder"
# ... other variables

# Deploy
python deploy_agent.py

3. Test

# Edit test_agent.py  
TEST_MESSAGES = ["Hello!", "What can you do?"]

# Test
python test_agent.py

That's it! ✨


πŸ“š Documentation

πŸ“– Documentation


πŸ› οΈ Features

  • βœ… Bypasses ADK CLI bugs - No more ModuleNotFoundError
  • βœ… Production-ready templates - Copy, configure, deploy
  • βœ… Comprehensive error handling - Clear error messages
  • βœ… Automated testing scripts - Verify deployments work
  • βœ… Battle-tested - Used in production environments

πŸ“ Repository Structure

adk-agent-engine-deployment/
β”œβ”€β”€ README.md                          # This file
β”œβ”€β”€ LICENSE                            # MIT License
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ en/                           # English documentation
β”‚   β”‚   β”œβ”€β”€ README.md
β”‚   β”‚   β”œβ”€β”€ ADK_DEPLOYMENT_GUIDE.md
β”‚   β”‚   └── ADK_DEPLOYMENT_CHEATSHEET.md
β”‚   └── es/                           # Spanish documentation
β”‚       β”œβ”€β”€ README.md
β”‚       β”œβ”€β”€ ADK_DEPLOYMENT_GUIDE.md
β”‚       └── ADK_DEPLOYMENT_CHEATSHEET.md
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ deploy_agent.py               # Deployment template
β”‚   └── test_agent.py                 # Testing template
└── examples/
    └── weather_agent/                # Complete working example
        β”œβ”€β”€ agent.py
        β”œβ”€β”€ __init__.py
        β”œβ”€β”€ deploy_agent.py
        └── test_agent.py

🎯 How It Works

The CLI Problem

# ❌ This fails
adk deploy agent_engine --project=... --region=... agent_folder

# Error: ModuleNotFoundError: No module named 'agent_engine_app'

Our Solution

# βœ… This works
from vertexai.agent_engines import AdkApp
from vertexai import agent_engines

app = AdkApp(agent=root_agent)
remote_app = agent_engines.create(
    app,
    requirements=["google-cloud-aiplatform[adk,agent_engines]>=1.132.0"],
    extra_packages=["./your_agent_folder"],  # ⭐ Key difference
    display_name="My Agent",
)

Key Points:

  1. Uses Python API directly (no CLI)
  2. Explicitly includes agent folder via extra_packages
  3. Avoids temporary file creation bugs
  4. Full control over deployment process

πŸ“– Usage Example

# 1. Create your agent
from google.adk.agents import Agent

root_agent = Agent(
    name="my_agent",
    model="gemini-2.0-flash",
    instruction="You are a helpful agent",
    tools=[get_weather, get_time]
)

# 2. Copy templates
cp templates/deploy_agent.py .
cp templates/test_agent.py .

# 3. Configure
# Edit deploy_agent.py with your PROJECT_ID, etc.

# 4. Deploy
python deploy_agent.py

# 5. Test  
python test_agent.py

πŸ”§ Troubleshooting

Common Errors

Error Solution
ModuleNotFoundError: No module named 'agent_engine_app' Don't use CLI, use our templates
'AgentEngine' object has no attribute 'query' Use async_stream_query() not query()
No module named 'your_agent_folder' Add extra_packages=["./your_agent_folder"]
cannot import name 'root_agent' Verify __init__.py exports root_agent

Full troubleshooting guide: English | EspaΓ±ol


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Areas for Contribution

  • Additional examples
  • Support for other deployment targets (Cloud Run, GKE)
  • Automated testing improvements
  • Documentation translations to other languages

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Adri - Applied AI Engineer @ Aselvia

  • Expertise: ADK, Multi-Agent Systems, Google Cloud
  • Background: 3D Video Game Artist turned AI Engineer

πŸ™ Acknowledgments

  • Google ADK team for the excellent framework
  • Vertex AI Agent Engine team
  • Community members who identified and reported the CLI bug

πŸ”— Useful Links


⭐ Star This Repository

If this toolkit helped you deploy your ADK agents successfully, please consider giving it a star! ⭐

It helps others discover this solution and motivates continued maintenance.


Quick Links:

About

Production-ready deployment solution for Google ADK Agents to Vertex AI Agent Engine. Fixes the critical CLI bug (ModuleNotFoundError: agent_engine_app) with programmatic deployment templates. Includes comprehensive guide.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages