Add Google ADK integration (auto-instrumentation + Penelope Target) - #2010
Add Google ADK integration (auto-instrumentation + Penelope Target)#2010Ayush7614 wants to merge 2 commits into
Conversation
Implement GoogleADKIntegration with Runner plugin injection and run tracing, add GoogleADKTarget for multi-turn Penelope testing via session_id, and add unit tests for issue rhesis-ai#1868.
There was a problem hiding this comment.
Two small issues to address before shipping:
- Penelope target:
asyncio.run()inGoogleADKTarget.send_message()will fail when called under an existing event loop. - SDK integration: runner
runwrapper records input twice; output event should be added without repeating input.
| ) as span: | ||
| add_agent_io_events(span, new_message, None) | ||
| result = await original(self, *args, **kwargs) | ||
| add_agent_io_events(span, new_message, result) |
There was a problem hiding this comment.
Improvement: add_agent_io_events(span, new_message, result) will record the input a second time (you already recorded input at line 114).
Fix: change the second call to only add the output event, e.g.
add_agent_io_events(span, None, result)(or add a dedicatedadd_agent_output_event).
There was a problem hiding this comment.
Fixed in d202e83: second add_agent_io_events now only records the output (add_agent_io_events(span, None, result)).
| session_id = conversation_id or "default" | ||
| try: | ||
| if inspect.iscoroutinefunction(self.runner.run): | ||
| return asyncio.run(self._async_send_message(message, session_id, **kwargs)) |
There was a problem hiding this comment.
Improvement: asyncio.run(...) will raise RuntimeError: asyncio.run() cannot be called from a running event loop if Penelope is invoked from an async context (e.g., notebooks / async test harnesses).
Fix: adopt the project’s existing pattern of a safe async runner (detect running loop and run the coroutine in a separate thread / provide an async
send_message_async).
There was a problem hiding this comment.
Fixed in d202e83: send_message now uses rhesis.sdk.async_utils.run_sync(...) for async runners (safe even if a loop is already running). Added test coverage for the running-loop case.
Record runner output events without duplicating input and use run_sync for async ADK runner calls so send_message works under a running loop.
|
Re-reviewed after d202e83: the two items I flagged are addressed (no duplicate input event in |
|
cc: @harry-rhesis |
Purpose
Add Google ADK auto-instrumentation and a Penelope target for multi-turn agent testing with session continuity.
Closes #1868
What Changed
GoogleADKIntegrationinjecting a globalRhesisADKPlugininto ADKRunnerinstancesRunner.runfor latency and I/O spans withsession_idattributesGoogleADKTargetsupporting Runner or Agent (auto-builds Runner + in-memory sessions)get_all_integrations()and addedgoogle-adkoptional depsTesting
cd sdk && uv run pytest ../tests/sdk/telemetry/integrations/test_google_adk_integration.py ../tests/sdk/telemetry/integrations/test_langgraph_integration.py -qcd penelope && uv run pytest ../tests/penelope/targets/test_google_adk.py -q