This example shows how to use Agent Control's @control() decorator inside a
Google ADK app.
Use this example if you want ADK as the host framework but prefer Agent Control's decorator model for tool protection.
@control()on ADK tool functions- automatic step registration from decorated functions
- pre-tool blocking for restricted cities
- post-tool output filtering for synthetic unsafe output
- optional sdk-local execution without changing the agent code
- Start the Agent Control server from the repo root:
# From repo root
make server-run- Install the example dependencies:
# In separate shell
cd examples/google_adk_decorator
uv pip install -e . --upgrade- Set your Google API key:
export GOOGLE_API_KEY="your-key-here"- Optional environment variables:
export AGENT_CONTROL_URL=http://localhost:8000
export GOOGLE_MODEL=gemini-2.5-flashDefault server execution:
cd examples/google_adk_decorator
uv run python setup_controls.pyOptional sdk-local execution:
cd examples/google_adk_decorator
uv run python setup_controls.py --execution sdkThe example code does not change between modes. The only difference is where the controls run:
server- evaluation happens on the Agent Control serversdk- evaluation happens locally in the Python SDK after the controls are fetched
The setup script creates namespaced controls for this example:
adk-decorator-block-restricted-citiesadk-decorator-block-internal-contact-output
cd examples/google_adk_decorator
uv run adk run my_agentSafe request:
What time is it in London?
Restricted city blocked before the tool call:
What is the weather in Pyongyang?
Synthetic unsafe tool output blocked after the tool call:
What time is it in Testville?
For more details on this example, see the Docs.
Tip: If you want the framework-native, attach-once ADK integration, use
examples/google_adk_plugin/instead.