apache/beam · error · ValueError

Agent did not return a response, final event

Error message

Agent {runner.agent.name} did not return a response, final event: {event}

What it means

During inference the ADK runner emitted a final event whose content carried no text parts, so _invoke_agent has no response to return; the error includes the final event to show what the agent produced instead.

Solutions

  1. Inspect the final event in the message to see what the agent returned (e.g. tool calls or empty content)
  2. Adjust the agent so its final response contains text parts (e.g. ensure a final LLM answer step)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at sdks/python/apache_beam/ml/inference/agent_development_kit.py:301 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/1245edeb8605044f. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/ml/inference/agent_development_kit.py:301

    try:
      # Attempt to get the specific session
      await runner.session_service.get_session(session_id)
    except Exception as e:
      await runner.session_service.create_session(
          app_name=app_name,
          user_id=user_id,
          session_id=session_id,
      )

    async for event in runner.run_async(
        user_id=user_id,
        session_id=session_id,
        new_message=message,
    ):
      if event.is_final_response():
        if event.content and event.content.parts:
          return "".join([p.text for p in event.content.parts])
        raise ValueError(
            f"Agent {runner.agent.name} did not return a response, "
            f"final event: {event}")

    raise ValueError(f"Agent {runner.agent.name} did not return a response")

  def get_metrics_namespace(self) -> str:
    return "ADKAgentModelHandler"

View on GitHub (pinned to 12126d8942)