# Practical and Useful Patterns with ADK
Deploy an agent without writing a single Dockerfile or K8s manifest? โ๏ธ With `adk deploy cloud_run`, your agent goes live on container serverless in one command. Add Dev UI too for seamless development and operations!
## ๐ Title
Cloud Run โ One-Command Container Serverless Deployment
## ๐ URL
## ๐งฉ Overview
ADK's Cloud Run deployment uses the `adk deploy cloud_run` command to deploy agents to a serverless environment without manual Dockerfile or manifest creation. Use `--with_ui` to bundle the Dev UI, `--session_service_uri=agentengine://
` to integrate with managed sessions, and get an auto-scaling web backend ready to go.
## ๐ How to Use
Basic deployment command:
```bash
adk deploy cloud_run \
--project=$GOOGLE_CLOUD_PROJECT \
--region=$GOOGLE_CLOUD_LOCATION \
$AGENT_PATH
```
Key options:
- `--with_ui`: Deploy the ADK development interface alongside the API server
- `--session_service_uri`: URI of the session service (pass `agentengine://` for Agent Runtime's managed sessions)
- `--service_name`: Customize the Cloud Run service name
- `--port`: Specify container listening port (default: 8000)
Alternatively, use `gcloud run deploy` with custom Dockerfiles to embed agents in existing FastAPI applications.
## ๐ Practical Usage
- **Sharing Prototypes**: Deploy with `--with_ui` to let your team try the agent via the Dev UI
- **Existing Web App Integration**: Use `gcloud run deploy` to add agent capabilities to custom FastAPI apps
- **Managed Sessions**: Use `--session_service_uri=agentengine://` for Agent Runtime session management, enabling stateful conversations
- **Auto-scaling**: Traffic-based auto-scaling for stable web backend operations
- **Auth Control**: Choose whether to allow unauthenticated access at deploy time. For private APIs, access via `gcloud auth print-identity-token`
## ๐ก Use Cases
- Quickly deploying agents with Dev UI as internal tools
- Adding agent features to existing FastAPI/Flask applications
- Running Slack bots or chat app backends in serverless mode
- Building stateful chat services with Agent Runtime managed sessions
## โ ๏ธ Caveats
- You'll be prompted about unauthenticated access during deployment โ only choose 'y' for public APIs
- Consider setting minimum instances for latency-sensitive workloads to mitigate cold starts
- `--with_ui` is for development โ configure proper authentication for production
- Default port is 8000 โ use `--port` to change if it conflicts with existing services
## โจ
No Dockerfile, no manifest. One command to ship a serverless agent to the world. Experience the simplicity of Cloud Run deployment! โก
#ADK# #AIAgent#