Skip to content

runner: a function response to a sub-agent's long-running call fails the run when the root is a workflow agent #1807

Open

Description

@Vivek1106-04

Describe the Bug:

With a ParallelAgent or SequentialAgent as the root, resuming a sub-agent's long-running tool call fails the whole run:

failed to run sub-agent "other": no function call event found for function responses ids: map[call-1:{}]

When the root isn't an LlmAgent, Run always runs the root again (runner.go#L687-L716). It never checks which agent the function response belongs to, so agents that never saw the call get it:

  • ParallelAgent{caller, other}: other runs on branch root.other. It can't see caller's function call (different branch), but it does see the user's response (empty branch), so its contents processor errors.
  • SequentialAgent{other, caller}: other re-runs first and fails the same way.

The LlmAgent-root path already handles this with findAgentToRun, which picks the agent that made the call.

Steps to Reproduce:

  1. ParallelAgent root with two llmagent sub-agents, one with a long-running tool
  2. First turn: the tool's agent returns a function call (call-1), the tool returns nil, so the call stays pending
  3. Second turn: send a FunctionResponse with ID call-1

Expected Behavior:
The sub-agent that made the call resumes on its own branch and answers. The other sub-agents don't re-run.

Observed Behavior:
The run fails with the error above, so the long-running call can never be completed.

Environment Details:

  • ADK Library Version: main (987c7bc)
  • OS: macOS
  • Go Version: 1.26.6

Additional Context:
adk-python sets invocation_context.agent = self._find_agent_to_run(...) for every root and then restores that agent's branch with _restore_branch_from_history (runners.py, _setup_context_for_new_invocation). It recently fixed the non-resumable case of this in "fix(runners): resolve invocation_id from FunctionResponse when is_resumable is False". I have a fix that does the same in the non-LlmAgent path of Run, with a test for Parallel and Sequential, and will open a PR.

One thing to check: with SequentialAgent{caller, other} the current code happens to work, because it re-runs caller and then also runs other. With the fix only caller resumes, which matches adk-python. Is that OK, or should the sequence continue after the resumed agent?

How often has this issue occurred?: Always

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions