Skip to content

[Bug]: ADK Runner async doesn't show Traces but LLM calls are appearing. #2467

@gdabas

Description

@gdabas

What component(s) are affected?

  • Opik Python SDK
  • Opik Typescript SDK
  • Opik Agent Optimizer SDK
  • Opik UI
  • Opik Server
  • Documentation

Opik version

  • Opik version: 1.7.32

Describe the problem

When using (ADK) Agent Development Kit, Opik doesn't show Traced (in Comet Dashboard Traces Tab) but show all LLM calls.

After debugging for more than an hour, I figures, when I switch to runner.run instead of runner.run_async then the Traces appear correctly. [referring to from google.adk.runners import Runner]

Seems like Opik is not working for async, and Google doesn't recommend using runner.run (sync) in Production. Please help.

Image Image

Reproduction steps and code snippets

Try using both runner.run and runner.run_async and noticed Traces shows for runner.run but not for async.

Here is the code I'm using:

async for event in runner.run_async(
            user_id=payload["user_id"], session_id=payload["session_id"], new_message=message
        ):
            # Check if the event is a response from the agent
            if event.is_final_response():
                if event.content and event.content.parts:
                    # Assuming text response in the first part
                    final_response_text = event.content.parts[0].text
                elif event.actions and event.actions.escalate:
                    final_response_text = f"Agent escalated: {event.error_message or 'No specific message.'}"
                break

    return final_response_text

Error logs or stack trace

No response

Healthcheck results

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions