Copied to Clipboard
Lint and Test the Main Python Code
The final step is to build, lint, and test the main Python code.
To Lint:
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$make lint
Linting Python code with Ruff...
ruff check backend
All checks passed!
Linting Frontend code with ESLint...
cd frontend && npm run lint
>frontend@0.0.0 lint
>eslint .
To Test:
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$make test
Running backend and connectivity tests...
python3 -m pytest test_live_connection.py test_ws_backend.py test_ws_backend_v2.py backend/app/biometric_agent/test_agent.py
================================================================ test session starts ================================================================
platform linux -- Python 3.13.13, pytest-9.0.3, pluggy-1.6.0
rootdir: /home/xbill/gemini-cli-aws/gemini31-fargate
plugins: anyio-4.13.0, asyncio-1.3.0
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 8 items
test_live_connection.py . [12%]
test_ws_backend.py . [25%]
test_ws_backend_v2.py . [37%]
backend/app/biometric_agent/test_agent.py ..... [100%]
================================================================= warnings summary ==================================================================
../../.pyenv/versions/3.13.13/lib/python3.13/site-packages/google/adk/features/_feature_decorator.py:72
/home/xbill/.pyenv/versions/3.13.13/lib/python3.13/site-packages/google/adk/features/_feature_decorator.py:72: UserWarning: [EXPERIMENTAL] feature FeatureName.PLUGGABLE_AUTH is enabled.
check_feature_enabled()
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================== 8 passed, 1 warning in 2.67s ============================================================
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$
Running Locally
The main Python Code can then be run locally:
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$source biosync.sh
Local URL
http://127.0.0.1:8080/
/home/xbill/.pyenv/versions/3.13.13/lib/python3.13/site-packages/google/adk/features/_feature_decorator.py:72: UserWarning: [EXPERIMENTAL] feature FeatureName.PLUGGABLE_AUTH is enabled.
check_feature_enabled()
2026年04月15日 20:06:48,642 - INFO - System Config: 2.0 FPS, 10.0s Heartbeat
Serving static files from: /home/xbill/gemini-cli-aws/gemini31-fargate/frontend/dist
INFO: Started server process [11513]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
Then connect to the local front end:
Deploying to ECS
A utility script runs the deployment to AWS ECS Fargate. Use the deploy version from the local system:
aws login --remote
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$source save-aws-creds.sh
Exporting AWS credentials...
Successfully saved credentials to .aws_creds
The Makefile will now automatically use these for deployments.
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$
The system can now be deployed:
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$make deploy
./save-aws-creds.sh
Exporting AWS credentials...
Successfully saved credentials to .aws_creds
The Makefile will now automatically use these for deployments.
./deploy-fargate.sh
And status checked:
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$make status
--- Fargate Cluster Status ---
-------------------------------------------------------------
| DescribeClusters |
+--------------------------+----------+----------+----------+
| Name | Pending | Running | Status |
+--------------------------+----------+----------+----------+
| biometric-scout-cluster | 0 | 1 | ACTIVE |
+--------------------------+----------+----------+----------+
--- Fargate Service Status ---
-------------------------------------------------------------
| DescribeServices |
+---------+----------+---------------------------+----------+
| Desired | Running | Service | Status |
+---------+----------+---------------------------+----------+
| 1 | 1 | biometric-scout-service | ACTIVE |
+---------+----------+---------------------------+----------+
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$
Once the container is deployed- you can then get the endpoint:
xbill@penguin:~/gemini-cli-aws/gemini31-fargate$make endpoint
--- Fargate HTTPS Endpoint ---
Application URL: https://biometric-scout-alb-1410555012.us-east-1.elb.amazonaws.com
The service will be visible in the AWS console:
Running the Web Interface
Start a connection to the deployed app:
https://biometric-scout-alb-1410555012.us-east-1.elb.amazonaws.com
Then connect to the app :
Then use the Live model to process audio and video:
Finally — complete the sequence:
Gemini CLI Code Review
As a final step — Gemini CLI was used for a full code review of the project:
✦ Based on my comprehensive review of the "Alpha Rescue Drone - Biometric Security System," the codebase is exceptionally well-structured,
follows modern engineering standards, and strictly adheres to the specialized requirements for Gemini 3.1 Flash Live and the Google Agent
Development Kit (ADK).
Core Architecture & Integration
The system excels at orchestrating a high-frequency, multimodal data stream. The use of a binary protocol (0x01 for audio, 0x02 for video)
in useGeminiSocket.js minimizes overhead, while the monkey-patching utility in patch_adk.py demonstrates a sophisticated understanding of
the evolving Gemini 3.1 Live API. This proactive approach ensures compatibility with features like send_realtime_input that are not yet
natively handled by the standard ADK.
Backend Analysis
- Agent Intelligence: The instructions in agent.py are precise and prioritize safety (offensive gesture detection) and hidden overrides
("Devil's Horns") effectively.
- Resilience: The backend implements a heartbeat stimulus (CONTINUE_SURVEILLANCE) and a neural handshake, which are critical for
maintaining model engagement during visual-only periods.
- Model Fallback: The get_model_id() logic is clever, automatically switching to gemini-2.5-flash for CLI runs to prevent 404 errors,
while defaulting to the high-performance gemini-3.1-flash-live-preview for production.
Frontend & UI/UX
- Aesthetic: The "Neon Cyan" HUD in BiometricLock.jsx provides a high-fidelity, futuristic feel that aligns with the "Mission Alpha"
theme.
- Feedback Loop: The synchronization between the random sequence generation, visual matching, and the special "Heavy Metal" audio event
creates a compelling user experience.
- Efficiency: Utilizing toBlob with JPEG compression (0.6) for the 2 FPS video stream is an optimal choice for balancing visual clarity
with network latency.
Testing & Maintainability
- Validation: The project maintains a clean slate with 100% test and linting compliance. The inclusion of mock.sh is a significant
developer productivity boost.
- Standards: The use of Ruff for Python and ESLint for the frontend ensures long-term code quality.
Recommendations
1. Connection Resilience: While the SYSTEM_ERROR closes the socket correctly, the frontend could benefit from a more graceful
"Reconnecting..." state if the network fluctuates during a mission.
2. Patch Management: As the Gemini Live API stabilizes, keep an eye on official ADK updates to deprecate the manual unrolling of
media_chunks in patch_adk.py.
3. Security: Verify that the .env variables are correctly injected into the Cloud Run environment via the Makefile or cloudbuild.yaml
without being exposed in the build logs.
Overall, the system is a robust and creative implementation of real-time multimodal AI. Authentication Protocol: Stable. 🤘
? for shortcuts
Summary
The Agent Development Kit was used to enable a multi-modal agent using the Gemini Live Model. This Agent was tested locally with the CLI and then deployed to Amazon Fargate. Several key take-aways and lessons learned were summarized from working with the transition to a new Live Gemini LLM model. Finally, Gemini CLI was used for a complete project code review.