feat(agentsec): add Google ADK agent example with agentsec protection#103
Conversation
Demonstrates Cisco AI Defense runtime protection for Google Agent Development Kit (ADK) agents using the agentsec SDK. The example shows automatic patching of Gemini LLM calls (via google-genai) and MCP tool calls, with both pre-call and post-call inspection by AI Defense in monitor mode. Made-with: Cursor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03ca7ad1a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dependencies = [ | ||
| "google-adk>=1.0.0", | ||
| "google-genai>=1.14.0,<2.0.0", | ||
| "mcp>=1.6.0,<2.0.0", | ||
| "python-dotenv>=1.0.0", |
There was a problem hiding this comment.
Include aidefense SDK in example dependencies
agent.py imports from aidefense.runtime import agentsec, but this pyproject.toml does not declare cisco-aidefense-sdk (or an equivalent local path dependency), so following scripts/run.sh in a clean environment fails immediately with ModuleNotFoundError: No module named 'aidefense'. This makes the new example non-runnable out of the box, unlike the other framework examples in this directory that include the SDK dependency.
Useful? React with 👍 / 👎.
…headers - Switch pyproject.toml to Poetry format with cisco-aidefense-sdk as a local path dependency, matching the convention used by all other framework examples in 2-agent-frameworks/ - Add Apache 2.0 license headers to agent.py, run.sh, and test file - Add cisco-aidefense-sdk assertion to pyproject.toml unit test Made-with: Cursor
|
Note: The Google ADK integration (plugin + agentsec examples) has been moved to the standalone repository: https://github.com/cisco-ai-defense/aidefense-google-adk The agentsec examples from this PR have been adapted and expanded in cisco-ai-defense/aidefense-google-adk#1, consistent with the pattern used by |
Summary
examples/agentsec/2-agent-frameworks/google-adk-agent/google-genai) and MCP tool callsSecurityPolicyErrorhandling for enforce modeFiles
agent.py— Main example:LlmAgentwith agentsec + optional MCP toolsetpyproject.toml— Dependencies (google-adk, google-genai, mcp, python-dotenv)scripts/run.sh— Convenience runner scripttests/unit/test_google_adk_example.py— Unit tests validating structure and integrationTest plan
gemini-2.5-flashon Vertex AISecurityPolicyErroris caught and displayed when policy blocks a requestAGENTSEC_LOG_LEVEL=DEBUGin.envto see full inspection flowMade with Cursor