Skip to content

Commit a52a2d4

Browse files
itsatefekoverholt
andauthored
docs(workflows): clarify delegation tool naming and task completion behavior in collaboration examples (#1935)
Co-authored-by: Kristopher Overholt <koverholt@google.com>
1 parent eebc269 commit a52a2d4

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

docs/workflows/collaboration.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ a small team of subagents and assign them to a coordinator agent:
5959
root = Agent(
6060
name="travel_planner", # coordinator agent
6161
sub_agents=[weather_agent, flight_agent],
62-
# Auto-injects: request_task_weather_checker, request_task_flight_booker
62+
# Auto-injects delegation tools named after each subagent:
63+
# weather_checker, flight_booker
6364
)
6465
```
6566

@@ -68,7 +69,8 @@ a small team of subagents and assign them to a coordinator agent:
6869
In ADK Go v2.0.0, the `Mode` field on `llmagent.Config` accepts the same
6970
mode strings as Python: `"chat"`, `"task"`, and `"single_turn"`. Declaring
7071
`SubAgents` on the coordinator agent causes ADK to automatically generate
71-
`request_task_<name>` delegation tools, exactly as in Python.
72+
a delegation tool for each subagent, named after the subagent itself,
73+
exactly as in Python.
7274

7375
```go
7476
--8<-- "examples/go/snippets/workflows/collaboration/main.go:get-started"
@@ -130,7 +132,7 @@ each mode:
130132
<tr>
131133
<td><strong>Return to parent</strong></td>
132134
<td>Manual (via transfer)</td>
133-
<td>Automatic (via <code>complete_task</code>)</td>
135+
<td>Automatic (via <code>finish_task</code>)</td>
134136
<td>Automatic (with result)</td>
135137
</tr>
136138
</tbody>
@@ -160,11 +162,11 @@ automatically advances to the next node based on the logic of the workflow
160162
agent's graph.
161163

162164
**As a transferee from an LlmAgent:** When a parent ***LlmAgent*** transfers
163-
control to a task agent via `request_task`, the task agent executes until it
164-
calls `complete_task`. At that point, control automatically returns to the
165-
originating agent that initiated the transfer. This behavior differs from
166-
default, chat ***mode*** agents, which require explicit `transfer_to_agent`
167-
calls to hand back control.
165+
control to a task agent via the delegation tool named after that subagent, the
166+
task agent executes until it calls `finish_task`. At that point, control
167+
automatically returns to the originating agent that initiated the transfer.
168+
This behavior differs from default, chat ***mode*** agents, which require
169+
explicit `transfer_to_agent` calls to hand back control.
168170

169171
<table>
170172
<thead>

examples/go/snippets/workflows/collaboration/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
// - "chat" (ModeChat, default): full user interaction; agent controls
2626
// flow until it explicitly calls transfer_to_agent.
2727
// - "task" (ModeTask): agent may ask the user clarifying questions and
28-
// automatically returns control to the parent when it calls complete_task.
28+
// automatically returns control to the parent when it calls finish_task.
2929
// - "single_turn" (ModeSingleTurn): no user interaction; executes one turn
3030
// and returns automatically; can run in parallel with peer agents.
3131
//
3232
// When a coordinator llmagent declares SubAgents, ADK automatically generates
33-
// request_task_<name> tools for each subagent, wiring the delegation pattern.
33+
// a delegation tool for each subagent, named after the subagent itself,
34+
// wiring the delegation pattern.
3435
//
3536
// When an llmagent is used as a node in the v2 workflow graph engine
3637
// (workflow.NewAgentNode), the engine automatically applies ModeSingleTurn
@@ -130,8 +131,8 @@ func newCollaborativeTeam(ctx context.Context) (agent.Agent, error) {
130131
}
131132

132133
// The coordinator agent declares SubAgents. ADK automatically generates
133-
// request_task_weather_checker and request_task_flight_booker tools so the
134-
// coordinator can delegate work to each subagent.
134+
// weather_checker and flight_booker delegation tools, named after each
135+
// subagent, so the coordinator can delegate work to each one.
135136
return llmagent.New(llmagent.Config{
136137
Name: "travel_planner",
137138
Model: model,

0 commit comments

Comments
 (0)