Skip to content

feat(agentsec): add Google ADK agent example with agentsec protection#103

Merged
urajat merged 2 commits into
cisco-ai-defense:mainfrom
shiva-guntoju-09:feat/google-adk-example
Apr 9, 2026
Merged

feat(agentsec): add Google ADK agent example with agentsec protection#103
urajat merged 2 commits into
cisco-ai-defense:mainfrom
shiva-guntoju-09:feat/google-adk-example

Conversation

@shiva-guntoju-09

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a Google Agent Development Kit (ADK) example under examples/agentsec/2-agent-frameworks/google-adk-agent/
  • Demonstrates Cisco AI Defense runtime protection for ADK agents: automatic patching of Gemini LLM calls (via google-genai) and MCP tool calls
  • Includes pre-call and post-call inspection by AI Defense in monitor mode, with SecurityPolicyError handling for enforce mode
  • Verified end-to-end: agentsec patches all 7 client types, MCP toolset connects via StreamableHTTP, Gemini responds via Vertex AI, both request and response inspected by AI Defense

Files

  • agent.py — Main example: LlmAgent with agentsec + optional MCP toolset
  • pyproject.toml — Dependencies (google-adk, google-genai, mcp, python-dotenv)
  • scripts/run.sh — Convenience runner script
  • tests/unit/test_google_adk_example.py — Unit tests validating structure and integration

Test plan

  • Example runs end-to-end with gemini-2.5-flash on Vertex AI
  • agentsec debug logs confirm request + response inspection by AI Defense API
  • SecurityPolicyError is caught and displayed when policy blocks a request
  • Reviewer: verify with AGENTSEC_LOG_LEVEL=DEBUG in .env to see full inspection flow

Made with Cursor

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
@shiva-guntoju-09 shiva-guntoju-09 requested a review from urajat April 7, 2026 17:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +7 to +11
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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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
@urajat urajat merged commit ec6b7ef into cisco-ai-defense:main Apr 9, 2026
5 checks passed
@shiva-guntoju-09

Copy link
Copy Markdown
Collaborator Author

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 ai-defense-langchain-middleware and other framework integrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants