A secure shopping assistant agent built using the Agent Development Kit (ADK) and the Google GenAI SDK. This project showcases structured ReAct agent logic, security/business boundaries, and outcome-based unit/integration testing.
secure-agent-lab/
├── shopping-assistant/ # Core shopping assistant project
│ ├── app/ # Main agent logic and tools
│ │ ├── agent.py # Agent initialization and Custom Gemini client
│ │ └── tools.py # Store state, Pydantic validation, and tools
│ ├── tests/ # Testing suite
│ │ ├── test_agent.py # Outcome-based security & logic tests
│ │ └── conftest.py # Pytest fixtures and configs
│ ├── pyproject.toml # uv dependencies and tool configurations
│ └── README.md # Subproject readme
├── threat_model.md # STRIDE Threat Modeling assessment
└── README.md # Root project readme (this file)
-
Role-Based Authorization Policies:
- Only pre-registered administrators (
admin-123,admin-456) are authorized to change discount code statuses via theupdate_discount_statustool. Regular users are blocked.
- Only pre-registered administrators (
-
Idempotency Guardrails:
- Loyalty points cannot be awarded more than once for the same
purchase_idto prevent double-claiming exploits.
- Loyalty points cannot be awarded more than once for the same
-
Data & Registration Integrity Checks:
- The agent requires a registered
user_idto redeem discount codes. - Points awarded via
award_loyalty_pointsmust be strictly positive integers.
- The agent requires a registered
-
Multi-Model API Compatibility:
- Dynamically supports both Google Cloud Vertex AI (default) and Google AI Studio (
GEMINI_API_KEY) to bypass project billing restrictions.
- Dynamically supports both Google Cloud Vertex AI (default) and Google AI Studio (
- uv: Python package manager - Install uv
- agents-cli: Google Agents CLI - Install with
uv tool install google-agents-cli
You can run the interactive agent playground locally using either Google Cloud credentials or a Google AI Studio API key.
Get a free API key from Google AI Studio and run:
cd shopping-assistant
export GEMINI_API_KEY="your_ai_studio_api_key"
agents-cli playgroundEnsure your gcloud project has billing enabled and run:
cd shopping-assistant
gcloud auth application-default login
agents-cli playgroundOnce running, navigate to http://127.0.0.1:8080/dev-ui/?app=app to interact with the agent.
To verify that the agent's security guardrails are functioning and correctly handling simulated LLM turns, run the test suite:
cd shopping-assistant
uv run pytest tests/test_agent.py