Deploy Multimodal ADK Agent with Gemini 3.1 on Lightsail

Use Google's ADK and Python to build a bi-directional streaming multimodal agent powered by Gemini 3.1 Flash Live, test locally, and deploy to Amazon Lightsail for real-time audio/video processing.

Streamline Multimodal Agent Setup with pyenv, nvm, and Gemini CLI

Install Python 3.13 via pyenv for consistent ML/AI library support across platforms, addressing version fragmentation common in deployments. Pair with nvm for Node.js management to run Gemini CLI (npm install -g @google/gemini-cli), which authenticates via Google account or API key and enables real-time code assistance. Clone the repo (git clone https://github.com/xbill9/gemini-cli-aws; cd gemini31-lightsail), source init.sh to set env vars like PROJECT_ID, then verify: python --version shows 3.13.12. Build frontend with make frontend (uses Vite, outputs dist/ with index.html, CSS/JS bundles under 250kB gzipped). Test mock UI at http://127.0.0.1:8080/ via make mock, confirming multimedia without model calls.

Validate and Run ADK Agent Locally for Real-Time Biometrics

ADK (google.github.io/adk-docs) orchestrates multi-agent systems with modularity and tools like Google Search. Lint with make lint (ruff checks 10 files, ESLint frontend), test 8 pytest cases (biometric_agent, live_connection, ws_backend) passing in 2.59s. Run ADK CLI via make testadk: interacts with biometric_agent (e.g., 'hello' → 'Scanner Online'). Launch web server (make adk) at http://0.0.0.0:8000, enable CORS for Cloud Shell (--allow_origins 'regex:.*'). Full app (make run) serves at http://127.0.0.1:8080 with 2 FPS video, 10s heartbeat, handling raw audio/video streams (no JSON overhead) via Worklet for off-main-thread processing. UI supports live Gemini 3.1 Flash Live (ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-live-preview) for low-latency voice/video in 200+ countries.

Deploy to Lightsail for Production Multimodal Streaming

Switch from Vertex AI (PROJECT_ID/REGION) to Gemini API key for 3.1 Live support, adding monkey patch in GEMINI.md for ADK compatibility (open GitHub issues noted). Save AWS creds (make deploy runs save-aws-creds.sh, deploy-lightsail.sh). Container deploys in seconds; check status (ACTIVE/DEPLOYING), endpoint like https://biometric-scout-service.6wpv8vensby5c.us-east-1.cs.amazonlightsail.com/. Lightsail (aws.amazon.com/lightsail) provides pre-configured VPS for low-cost hosting. Access UI for end-to-end: camera/mic input → agent processes biometrics (e.g., scan face → 'Access Granted'). Changes from original codelab: CLI error handling, JSON-free protocol reduces latency, client audio updates.

Gemini CLI review praises structure for Gemini 3.1 adherence, enabling rapid iteration from local to cloud.

Summarized by x-ai/grok-4.1-fast via openrouter

9782 input / 2153 output tokens in 24379ms

© 2026 Edge