Back to Prompt Library
implementation

Integrate Graphite for Observability

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
13
Sections
5
Linked challenge
Secure Personal Intelligence Agent with Google ADK & Gemini 2.5 Pro

Prompt source

Original prompt text with formatting preserved for inspection.

13 lines
5 sections
No variables
1 code block
Modify your Google ADK agent to send detailed traces and logs to Graphite for every tool call, LLM interaction, and decision point. Ensure that privacy-sensitive information is masked or omitted from logs. Your implementation should demonstrate how Graphite helps in debugging the agent's reasoning process and verifying data access decisions. 

```python
# from google_adk.tools import Tool
# from graphite import Client

# graphite_client = Client(api_key="YOUR_GRAPHITE_API_KEY")

# class TracedGmailReader(SimulatedGmailReader):
#    def call(self, user_id: str, consent_level: dict):
#        graphite_client.log_event("Gmail_Tool_Call_Start", {"user_id": user_id, "requested_access": "email"})
#        response = super().call(user_id, consent_level)
#        graphite_client.log_event("Gmail_Tool_Call_End", {"user_id": user_id, "response_status": "success" if "Access denied" not in response else "denied"})
#        return response

# (Then use TracedGmailReader in your agent)
```

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.