Back to Prompt Library
implementation
Implement Simulated Secure Data Tools
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Secure Personal Intelligence Agent with Google ADK & Gemini 2.5 Pro
Format
Code-aware
Lines
14
Sections
4
Linked challenge
Secure Personal Intelligence Agent with Google ADK & Gemini 2.5 Pro
Prompt source
Original prompt text with formatting preserved for inspection.
14 lines
4 sections
No variables
1 code block
Develop Python classes that simulate secure access to personal data (Gmail, Google Photos). These tools should expose methods like `read_emails(user_id, consent_level)` or `analyze_photos(user_id, tags, consent_level)`. Crucially, each method must check a `consent_level` parameter before returning any data, simulating a secure access mechanism. Integrate these as custom tools for your Google ADK agent.
```python
from google_adk.tools import Tool, tool_decorator
# from vertexai.preview.generative_models import GenerativeModel
# @tool_decorator
# class SimulatedGmailReader(Tool):
# def call(self, user_id: str, consent_level: dict):
# if consent_level.get('email') == 'full':
# # Simulate fetching emails
# return [{"subject": "Meeting", "body": "Details..."}]
# return "Access denied to email data."
# agent = create_agent(model=GenerativeModel("gemini-2.5-pro"), tools=[SimulatedGmailReader()])
# agent.run_conversation("user123", "Summarize my latest emails.")
```Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.