Skip to content

RemoteA2AAgent fails to send taskId in multi-turn scenarios #4934

Closed

Description

@kthota-g

🔴 Required Information

Describe the Bug:
RemoteA2AAgent only sends contextId and doesn't send the associated taskId for multi-turn A2A scenarios.

Steps to Reproduce:

  1. Create an agent with a RemoteA2AAgent as show below. You can use currency agent from a2a-samples repository.
from google.adk.agents.llm_agent import Agent

from google.adk.agents.remote_a2a_agent import RemoteA2aAgent

currency_agent = RemoteA2aAgent(
    name="currency_agent",
    agent_card="http://localhost:10999/.well-known/agent-card.json",
)

root_agent = Agent(
    model='gemini-2.5-flash',
    name='root_agent',
    description='A helpful assistant for user questions.',
    instruction='Helpful assistant to answer user queries. Use currency_agent for any currency related queries from the user',
    sub_agents=[currency_agent]
)
  1. Launch adk web and start a new conversation with message 'How much is 10 USD?'.
  2. A2A agent responds back with message 'Provide the currency to convert to' and task.status='input-required'.
  3. Send the message 'CAD' as user's second turn.

Expected Behavior:
ADK should invoke the remote agent with task_id and context_id for the second turn as the task has not terminated.

Observed Behavior:
ADK only sends the context_id in the ADK payload. This results in unexpected agent behavior and results in creation of new tasks for every turn and stale task records get created.


🟡 Optional Information

a2a_request = A2AMessage(
only sets the context_id.

Ideally RemoteA2AAgent implementation should include the taskId when the task status is in paused awaiting user input such as 'input-required', 'auth-required' states.

Regression:
No

How often has this issue occurred?:

  • Always (100%)

Activity

  1. added theissue type on Mar 20, 2026
  2. added
    core[Component] This issue is related to the core interface and implementation
    on Mar 20, 2026
  3. surajksharma07 commented on Mar 24, 2026

    @surajksharma07
    Collaborator

    Hey @kthota-g The issue is that _construct_message_parts_from_session never reads task_id from the event metadata, so only context_id ends up making it into the outgoing A2A request.

    Worth trying as a workaround: add task_id = metadata.get("a2a:task_id") in that same block and pass task_id=task_id through to the A2AMessage constructor.

    Could you check if that fixes the multi-turn flow on your end?

  4. kthota-g commented on Mar 24, 2026

    @kthota-g
    Author

    The A2AMessage object is created within the RemoteA2aAgent implementation.

    Code changes are needed to pass task_id depending on the task state, similar to how currently the context_id is passed.

  5. surajksharma07 commented on Mar 25, 2026

    @surajksharma07
    Collaborator

    @kthota-g You're right — the proper fix needs to be inside RemoteA2aAgent where the A2AMessage is constructed, conditionally including task_id when the task is in input-required or auth-required state (the same pattern already used for context_id).

    The PR #4944 by @shriramThakare3 is targeting this — worth tracking that one for the upstream fix.

    Team is looking more into it.

  6. surajksharma07 commented on Mar 25, 2026

    @surajksharma07
    Collaborator

    @Jacksunwei Please have a look into it once.

  7. removed their assignment
    on Apr 15, 2026
  8. added
    a2a[Component] This issue is related a2a support inside ADK.
    on Jul 21, 2026
  9. added a commit that references this issue on Oct 2, 2026
    539a0d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a2a[Component] This issue is related a2a support inside ADK.core[Component] This issue is related to the core interface and implementationneeds review[Status] The PR/issue is awaiting review from the maintainer

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions