Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Follow the steps outlined to deploy the app in Google Cloud
- The app will not start
Expected behavior
The app should start successfully to serve the requests.
Screenshots
NA
Desktop (please complete the following information):
- OS: macOS
- Python version(python -V): 3.11
- ADK version(pip show google-adk): 0.1.0
Potential Fix
- It should be
APP_DIR in agent_dir. Here is the working repo.
- Also the entry point should be
CMD ["python", "main.py"]
import os
import uvicorn
from fastapi import FastAPI
from google.adk.cli.fast_api import get_fast_api_app
# Get the directory where main.py is located
APP_DIR = os.path.dirname(os.path.abspath(__file__))
# Example session DB URL (e.g., SQLite)
SESSION_DB_URL = "sqlite:///./sessions.db"
# Example allowed origins for CORS
ALLOWED_ORIGINS = ["http://localhost", "http://localhost:8080", "*"]
# Set web=True if you intend to serve a web interface, False otherwise
SERVE_WEB_INTERFACE = True
# Call the function to get the FastAPI app instance
# Ensure the agent directory name ('capital_agent') matches your agent folder
app: FastAPI = get_fast_api_app(
agent_dir=APP_DIR,
session_db_url=SESSION_DB_URL,
allow_origins=ALLOWED_ORIGINS,
web=SERVE_WEB_INTERFACE,
)
# You can add more FastAPI routes or configurations below if needed
# Example:
# @app.get("/hello")
# async def read_root():
# return {"Hello": "World"}
if __name__ == "__main__":
# Use the PORT environment variable provided by Cloud Run, defaulting to 8000
uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 8000)))
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The app should start successfully to serve the requests.
Screenshots
NA
Desktop (please complete the following information):
Potential Fix
APP_DIRinagent_dir. Here is the working repo.CMD ["python", "main.py"]