Skip to content

Conversation

@shentongmartin
Copy link
Contributor

@shentongmartin shentongmartin commented Nov 18, 2025

Concurrent Transfer Feature

Summary

This PR introduces concurrent transfer capabilities to the ADK framework, enabling agents to transfer tasks to multiple sub-agents simultaneously using a fork-join execution model.

New APIs

Transfer Tools

  • ConcurrentTransferTool: Tool implementation supporting both single and concurrent transfers
    • Accepts agent_name (single) or agent_names (concurrent) parameters
    • Returns appropriate transfer action based on parameter count

Agent Configuration

  • ChatModelAgentConfig.TransferTool: Configurable transfer tool field
    • Default: &transferToAgent{} (single-agent transfers)
    • Option: &ConcurrentTransferTool{} (concurrent transfers)

Core Data Structures

  • ConcurrentTransferToAgentAction: Action type emitted by ConcurrentTransferTool for multiple destination agents
    • DestAgentNames []string: List of agents to execute concurrently

Usage Examples

Plain Agent Transfer

// Configure agent for concurrent transfers
agent, err := NewChatModelAgent(ctx, &ChatModelAgentConfig{
    Name:        "Orchestrator",
    Model:       chatModel,
    TransferTool: &ConcurrentTransferTool{},
})

// Tool call with multiple agents
{
    "agent_names": ["AnalyticsAgent", "ValidationAgent", "EnrichmentAgent"]
}

Supervisor Pattern

// Supervisor with concurrent sub-agent execution
supervisor, err := New(ctx, &Config{
    Supervisor: &ChatModelAgent{
        Name:        "Supervisor",
        TransferTool: &ConcurrentTransferTool{},
    },
    SubAgents: []adk.Agent{analyticsAgent, validationAgent, enrichmentAgent},
})

// Supervisor can transfer to selected sub-agents concurrently
// Results are automatically aggregated when all selected sub-agents complete

Complex Nested Supervisor

// Multi-level supervisor hierarchy with concurrent transfers
nestedSupervisor, err := New(ctx, &Config{
    Supervisor: subSupervisor,
    SubAgents:  []adk.Agent{grandChild1, grandChild2},
})

topSupervisor, err := New(ctx, &Config{
    Supervisor: superSupervisor,
    SubAgents:  []adk.Agent{subAgent1, nestedSupervisor},
})

// Both levels can execute transfers concurrently
// Interrupts and resumes are properly handled across concurrent lanes

Backward Compatibility

  • Existing single-agent transfers continue to work unchanged
  • No breaking changes to existing APIs
flowchart TD
    A[flowAgent receives ConcurrentTransferToAgentAction] --> B[runConcurrentLanes called]
    B --> C[Fork execution context for each agent]
    C --> D[Launch concurrent goroutines]
    
    D --> E1[Agent 1: Further Transfers]
    D --> E2[Agent 2: Workflow Agent]
    D --> E3[Agent 3: Custom Agent]
    
    E1 --> F1[Agent 1: May transfer to other agents]
    E2 --> F2[Agent 2: Complex workflow execution]
    E3 --> F3[Agent 3: Custom internal logic]
    
    F1 --> G[Join: Wait for all agents to complete]
    F2 --> G
    F3 --> G
    
    G --> H[Execution complete]
Loading

Change-Id: I30b5fe3a8122b86fdd2818bf66dec18bc155e33f
…ions

Change-Id: I2e6357acec95433e648fbdc8509ef44e6eb22dce
Change-Id: I67d05742e079b1fe7ee11dbadec9ac5c4c3ffd8c
This change exports the  function to , making it a public part of the API.

This is essential for developers who want to build their own custom composite nodes. To correctly implement the  and  interfaces, a custom node needs the ability to create distinct execution contexts for its internal, interruptible sub-components.

Exporting this function provides the necessary hook for that advanced use case. All internal call sites within the  package have been updated to use the new exported function name.

Change-Id: Ibbc651131333860064454f691b346ab87149824c
Change-Id: I54b60cd3ee79e20e92ec1fe1b2e870f18763f5b6
Change-Id: Ifad728c6c6ea59cb21b2e622ebad51f249b5fc91
Change-Id: Ia7f0b548fae95f610e4e59333c9ec9e60e13b827
…f clear it

Change-Id: I9ab6290573b1faf6bda39a282e7986df61f2307d
…ass in PathStep

Change-Id: I43c40b77ba74c6408dd3e930ea330bf4099e4f24
…and GetResumeContext

Change-Id: Ia97f4245db7edce7e784443cb36c14cc211043ce
Change-Id: Icd7dc35e924b1a9b58a933d6f5a7aaf0ab51c57a
Change-Id: Ifae23e99c2392a4e1f1e938cb725e76c5a71f886
Change-Id: I689c9ef7799020f0e988fd724620641efb71ef80
Change-Id: I5cf93f1a00ea0aaa07cde62ac5d0749a4a3912b1
Change-Id: If26cc015084802d7509ef9a8a46f17902a374e2a
Change-Id: I3d845adc10698f67443d11543e6cd6269dc69877
Change-Id: I4a26ff57b6c7ba4e969f6a3f0a9cfd4c5923fbd6
Change-Id: If4da271ab545e635151ee518e6258963bce8cc07
Change-Id: I4bf6a05cdf56db3c569df91ee1b82f679613a2e0
Change-Id: I1a9a8e43b5f9866be960082e34e394163e5ab8a4
Change-Id: I7b1336f0f22d2cf9ae652cc93e765749d574169f
Change-Id: I9a71c74798abd8452c5606dc99e8235f3f47c08c
Change-Id: I9d266db9334f564513ee565ce7cd4b66fbb18ac6
Change-Id: I06b27214ea6ffd5a2ad91ae5f9e4945327da1ffc
Change-Id: I15b4b03992cbfcfeb8e05eaf701dd1995dfb3152
Change-Id: I0698c6993a0900c7328eb294b031bdb8a5512d7e
Change-Id: Icefa6348431b6c60adef8dbc645e5190f3468bd7
Change-Id: I7e712285d5e32659a64ca678833a05be46638003
…instead of execution path

Change-Id: Ic41fbedf9d69f87719b174f664acc32ac803479d
… resume

Change-Id: I92929e7b4d8878b36c96cb8cfc8fd965ab6a607d
Change-Id: I9b3cdce373c58ef7aa889785f9a10553f97e04f8
Change-Id: Id5ca92169d9ac970ee2bab7b7793d183e328c026
Change-Id: I383e2f63e9705107b56d23ca96d08a201906b48f
Change-Id: Icd38b33fbfaa85a88b81d45a4de4dcc1071b7296
Change-Id: I24b22ed612695e3b1d96845a43b3c1fcf5af24b8
Change-Id: If0d7a4f4ea87a0bc557dde2cf8d1de60ebb2c962
…ough agent tools

Change-Id: I0c87569f053cc77347cf0bec3e77bb724001d6cf
Change-Id: Ia9dcb9b92541d3e9ba4ef82746bbd8386763d3c1
Change-Id: Ia85fe468da1813ac87867036d4e7f78d56666eb2
Change-Id: I6702795d6ea56490ca2d74faf1ba1682f7c2fbde
Change-Id: If346df6557317c84b19b16439770b800091a3786
Change-Id: Ic1f224f3d831b5be109681256896ac45b1f03355
Change-Id: I2df7a2266a5157e0b24fec3636d3a45553fde6dd
Change-Id: I13d8ad4c131b814d991c5e0590e3d53cf52f405c
Change-Id: I57da228e8b111f50713b4171a73d543d67d663bd
Change-Id: Ibf725b90e49082e8070be3ae659dd57e393d6b06
Change-Id: Ic22f596c5f6ed08db9db33fac4b7a0e731bca23b
Change-Id: Ic595fdc5f02c2e614440e03eaee45289712b3715
Change-Id: Ic7263f46c942f18f64d1d3cd84170517cc7f4868
Change-Id: I64654953e73696105bb0437d27adf707c35fe941
@shentongmartin shentongmartin force-pushed the feat/concurrent_transfer branch from ac6e088 to 0ca8a53 Compare November 18, 2025 12:01
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

📊 Coverage Report:

File coverage threshold (20%) satisfied:	PASS
Package coverage threshold (30%) satisfied:	PASS
Total coverage threshold (83%) satisfied:	PASS
Total test coverage: 83.8% (6899/8230)

Change-Id: Ic9e8d42ffa7c876a96f17bf4c899c91de8b6eff3
@shentongmartin shentongmartin force-pushed the feat/concurrent_transfer branch from 4dbe6a3 to bdee624 Compare November 19, 2025 02:46
@shentongmartin shentongmartin force-pushed the milestones/v060alpha branch 3 times, most recently from 1ce9099 to 4a4f0c1 Compare November 20, 2025 03:59
Base automatically changed from milestones/v060alpha to main November 20, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants