Files
wehub-resource-sync ec2b666284
Continuous Integration / Pre-commit Linter (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.10) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.11) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.12) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.10) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.11) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.12) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.14) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Waiting to run
Copybara PR Handler / close-imported-pr (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:25:13 +08:00
..

Managed Agent — Single-Turn Sub-Agent (Tool) Flow

For setup, authentication, backends, and background on ManagedAgent, see the ManagedAgent guide.

Overview

This sample shows a local LlmAgent coordinator that calls two server-backed ManagedAgent specialists as single-turn sub-agents (mode='single_turn'). ADK auto-exposes each single-turn sub-agent to the coordinator as an inline tool. The coordinator calls a specialist, receives the result, and may call several specialists in one turn before composing the final answer itself.

A single-turn sub-agent's internal events (e.g. tool calls) are preserved in the shared session history.

The two specialists are:

  • managed_search_agent — a ManagedAgent with the server-side google_search tool, for questions that require web search results.
  • managed_code_execution_agent — a ManagedAgent with server-side code execution, for questions that require computation.

Note

Each ManagedAgent sets a description; ADK builds the tool declaration from it, so a missing description makes tool selection unreliable.

Note

Each single-turn call is stateless and isolated, so the coordinator should pass a self-contained request to each specialist (do not rely on a specialist remembering a previous call).

Sample Inputs

  • What was the score of the most recent FIFA World Cup final?

    Requires web search results — the coordinator calls managed_search_agent.

  • What's the 30th Fibonacci number? Use code.

    Requires computation — the coordinator calls managed_code_execution_agent (answer: 832040).

  • Look up the height of Mount Everest in meters, then use code to convert it to feet.

    The coordinator calls both specialists in one turn (search for the height, then code to multiply by 3.28084) and composes a single answer.

Graph

graph TD
    Coordinator[LlmAgent coordinator] -->|single_turn tool call| Search[managed_search_agent]
    Coordinator -->|single_turn tool call| Code[managed_code_execution_agent]

How To

  • Coordinator: an LlmAgent with a non-empty sub_agents list of single-turn specialists.
  • Specialists: each is a ManagedAgent with mode='single_turn', an agent_id, an environment spec, server-side tools, and a description used for tool selection.
  • Delegation: ADK exposes each single-turn specialist as an inline tool; the coordinator calls it, gets the result, and keeps control of the turn.