Skip to content

Context not passed during transfer_to_agent delegation in ADK-JS 0.2.1 #44

@nimalchrist

Description

@nimalchrist

Please make sure you read the contribution guide and file the issues in the
right place.

Contribution guide.

Describe the bug
When a root agent with subAgents but no tools delegates to a sub-agent using the implicit transfer_to_agent function, the conversation context (user message) is not passed correctly, resulting in an error.
Error Message
Unable to submit request because it must include at least one parts field, which describes the prompt input.

Expected Behavior (Python ADK)
In Python ADK, a root agent can have an empty tools array and successfully delegate to sub-agents:

root_agent = Agent(
    name="coordinator",
    model="gemini-2.0-flash",
    tools=[],  # Empty tools - works fine
    sub_agents=[greeting_agent, farewell_agent]
)

Actual Behavior (TypeScript ADK 0.2.1)
In TypeScript ADK 0.2.1, the same pattern fails:

const rootAgent = new LlmAgent({
  name: 'coordinator',
  model: 'gemini-2.0-flash',
  tools: [],  // Empty tools - causes error
  subAgents: [greetingAgent, farewellAgent]
});

To Reproduce

  1. Create a root agent with subAgents but empty tools array
  2. Create sub-agents with their own specialized tools
  3. Send a user message that triggers delegation
  4. Root agent successfully calls transfer_to_agent
  5. Sub-agent receives request with missing parts field → Error

Current Workaround
Add ALL sub-agent tools to the root agent's tools array:

const rootAgent = new LlmAgent({
name: 'coordinator',
tools: [tool1, tool2, tool3], // All tools from all sub-agents
subAgents: [subAgent1, subAgent2]
});

Expected behavior
The expected behaviour is when the transfer_to_agent is called the child agent should get the context and based on that it should execute the appropriate tool.

Screenshots
Image

Desktop (please complete the following information):

  • OS: macOS
  • TS version/environment: 5.7.3
  • Environment
    • Package: @google/adk version ^0.2.1
    • Language: TypeScript
    • Model: Gemini 2.0 Flash

Impact
This prevents implementing the proper delegation pattern where the root agent is a pure orchestrator without direct tool access.

Related Documentation
Python ADK multi-agent pattern: https://google.github.io/adk-docs/tutorials/agent-team/#step-3-building-an-agent-team-delegation-for-greetings-farewells

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