Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions content/en/docs/eino/core_modules/eino_adk/agent_collaboration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ ADK defines collaboration and composition primitives to build multi‑agent syst

- Collaboration mode

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>Mode</td><td>Description</td></tr>
<tr><td>Transfer</td><td>Hand off the task to another agent. The current agent exits and does not wait for the child agent’s completion.</td></tr>
<tr><td>ToolCall (AgentAsTool)</td><td>Treat an agent as a tool, wait for its response, and use the output for subsequent processing.</td></tr>
</table>

- Input context strategy

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>Strategy</td><td>Description</td></tr>
<tr><td>Upstream full dialogue</td><td>Receive complete conversation history from upstream agents.</td></tr>
<tr><td>New task description</td><td>Ignore upstream dialogue and generate a fresh summary as input for the child agent.</td></tr>
</table>

- Decision autonomy

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>Autonomy</td><td>Description</td></tr>
<tr><td>Autonomous</td><td>Agent internally selects downstream agents (often via LLM) when needed. Even preset logic is considered autonomous from the outside.</td></tr>
<tr><td>Preset</td><td>Agent execution order is predetermined and predictable.</td></tr>
</table>

## Composition Types

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>Type</td><td>Description</td><td>Diagram</td><td>Collab</td><td>Context</td><td>Decision</td></tr>
<tr><td><strong>SubAgents</strong></td><td>Build a parent agent with a list of named subagents, forming a tree. Agent names must be unique within the tree.</td><td><a href="/img/eino/eino_adk_self_driving.png" target="_blank"><img src="/img/eino/eino_adk_self_driving.png" width="100%" /></a></td><td>Transfer</td><td>Upstream full dialogue</td><td>Autonomous</td></tr>
<tr><td><strong>Sequential</strong></td><td>Run subagents in order once, then finish.</td><td><a href="/img/eino/eino_adk_sequential_controller.png" target="_blank"><img src="/img/eino/eino_adk_sequential_controller.png" width="100%" /></a></td><td>Transfer</td><td>Upstream full dialogue</td><td>Preset</td></tr>
Expand All @@ -61,7 +61,7 @@ Concept

By default, assistant/tool messages from other agents are converted into user messages. This tells the current LLM: “Agent_A called some_tool with some_result. Now it’s your turn to decide.” It treats other agents’ behavior as external information rather than the current agent’s own actions, avoiding role confusion.

<a href="/img/eino/eino_adk_message_event.png" target="_blank"><img src="/img/eino/eino_adk_message_event.png" width="100%" /></a>
<a href="/img/eino/eino_adk_message_event.png" target="_blank"><img src="/img/eino/eino_adk_message_event.png" width="60%" /></a>

Filtering by RunPath

Expand All @@ -71,12 +71,12 @@ Definition: RunPathA “belongs to” RunPathB when RunPathA equals RunPathB or

Examples of RunPath in different orchestrations:

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>Example</td><td>RunPath</td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_sub_agent.png" target="_blank"><img src="/img/eino/eino_adk_run_path_sub_agent.png" width="100%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path.png" target="_blank"><img src="/img/eino/eino_adk_run_path.png" width="100%" /></a></td><td><li>Agent: [Agent]</li><li>Agent (after function call): [Agent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_sub_agent.png" target="_blank"><img src="/img/eino/eino_adk_run_path_sub_agent.png" width="20%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path.png" target="_blank"><img src="/img/eino/eino_adk_run_path.png" width="30%" /></a></td><td><li>Agent: [Agent]</li><li>Agent (after function call): [Agent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_collaboration_run_path_sequential.png" target="_blank"><img src="/img/eino/eino_adk_collaboration_run_path_sequential.png" width="100%" /></a></td><td><li>Agent1: [SequentialAgent, LoopAgent, Agent1]</li><li>Agent2: [SequentialAgent, LoopAgent, Agent1, Agent2]</li><li>Agent1: [SequentialAgent, LoopAgent, Agent1, Agent2, Agent1]</li><li>Agent2: [SequentialAgent, LoopAgent, Agent1, Agent2, Agent1, Agent2]</li><li>Agent3: [SequentialAgent, LoopAgent, Agent3]</li><li>Agent4: [SequentialAgent, LoopAgent, Agent3, ParallelAgent, Agent4]</li><li>Agent5: [SequentialAgent, LoopAgent, Agent3, ParallelAgent, Agent5]</li><li>Agent6: [SequentialAgent, LoopAgent, Agent3, ParallelAgent, Agent6]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_deterministic.png" target="_blank"><img src="/img/eino/eino_adk_run_path_deterministic.png" width="100%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li><li>Agent: [Agent, SubAgent, Agent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_deterministic.png" target="_blank"><img src="/img/eino/eino_adk_run_path_deterministic.png" width="50%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li><li>Agent: [Agent, SubAgent, Agent]</li></td></tr>
</table>

Customize via `WithHistoryRewriter`:
Expand Down Expand Up @@ -366,7 +366,7 @@ func AgentWithDeterministicTransferTo(_ context.Context, config *DeterministicTr

Used by Supervisor to ensure subagents return control deterministically:

<a href="/img/eino/eino_adk_deterministic_transfer.png" target="_blank"><img src="/img/eino/eino_adk_deterministic_transfer.png" width="100%" /></a>
<a href="/img/eino/eino_adk_deterministic_transfer.png" target="_blank"><img src="/img/eino/eino_adk_deterministic_transfer.png" width="50%" /></a>

```go
// github.com/cloudwego/eino/adk/prebuilt/supervisor.go
Expand Down Expand Up @@ -404,7 +404,7 @@ See details and examples: `/docs/eino/core_modules/eino_adk/agent_implementation

Run a series of agents in the provided order:

<a href="/img/eino/eino_adk_sequential_agent.png" target="_blank"><img src="/img/eino/eino_adk_sequential_agent.png" width="100%" /></a>
<a href="/img/eino/eino_adk_sequential_agent.png" target="_blank"><img src="/img/eino/eino_adk_sequential_agent.png" width="70%" /></a>

```go
type SequentialAgentConfig struct {
Expand All @@ -420,7 +420,7 @@ func NewSequentialAgent(ctx context.Context, config *SequentialAgentConfig) (Age

Based on SequentialAgent; after completing one run, it starts from the beginning again:

<a href="/img/eino/eino_adk_loop_definition.png" target="_blank"><img src="/img/eino/eino_adk_loop_definition.png" width="100%" /></a>
<a href="/img/eino/eino_adk_loop_definition.png" target="_blank"><img src="/img/eino/eino_adk_loop_definition.png" width="80%" /></a>

```go
type LoopAgentConfig struct {
Expand All @@ -438,7 +438,7 @@ func NewLoopAgent(ctx context.Context, config *LoopAgentConfig) (Agent, error)

Run agents concurrently:

<a href="/img/eino/eino_adk_parallel_agent.png" target="_blank"><img src="/img/eino/eino_adk_parallel_agent.png" width="100%" /></a>
<a href="/img/eino/eino_adk_parallel_agent.png" target="_blank"><img src="/img/eino/eino_adk_parallel_agent.png" width="80%" /></a>

```go
type ParallelAgentConfig struct {
Expand Down
28 changes: 14 additions & 14 deletions content/zh/docs/eino/core_modules/eino_adk/agent_collaboration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ weight: 4

- Agent 间协作方式

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>协作方式</td><td>描述</td></tr>
<tr><td> Transfer</td><td>直接将任务转让给另外一个 Agent,本 Agent 则执行结束后退出,不关心转让 Agent 的任务执行状态</td></tr>
<tr><td>ToolCall(AgentAsTool)</td><td>将 Agent 当成 ToolCall 调用,等待 Agent 的响应,并可获取被调用Agent 的输出结果,进行下一轮处理</td></tr>
</table>

- AgentInput 的上下文策略

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>上下文策略</td><td>描述</td></tr>
<tr><td>上游 Agent 全对话</td><td>获取本 Agent 的上游 Agent 的完整对话记录</td></tr>
<tr><td>全新任务描述</td><td>忽略掉上游 Agent 的完整对话记录,给出一个全新的任务总结,作为子 Agent 的 AgentInput 输入</td></tr>
</table>

- 决策自主性

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>决策自主性</td><td>描述</td></tr>
<tr><td>自主决策</td><td>在 Agent 内部,基于其可选的下游 Agent, 如需协助时,自主选择下游 Agent 进行协助。 一般来说,Agent 内部是基于 LLM 进行决策,不过即使是基于预设逻辑进行选择,从 Agent 外部看依然视为自主决策</td></tr>
<tr><td>预设决策</td><td>事先预设好一个Agent 执行任务后的下一个 Agent。 Agent 的执行顺序是事先确定、可预测的</td></tr>
</table>
- 组合原语

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>类型</td><td>描述</td><td>运行模式</td><td>协作方式</td><td>上下文策略</td><td>决策自主性</td></tr>
<tr><td><strong>SubAgents</strong></td><td>将用户提供的 agent 作为 父Agent,用户提供的 subAgents 列表作为 子Agents,组合而成可自主决策的 Agent,其中的 Name 和 Description 作为该 Agent 的名称标识和描述。<li>当前限定一个 Agent 只能有一个 父 Agent</li><li>可采用 SetSubAgents 函数,构建 「多叉树」 形式的 Multi-Agent</li><li>在这个「多叉树」中,AgentName 需要保持唯一</li></td><td><a href="/img/eino/eino_adk_self_driving.png" target="_blank"><img src="/img/eino/eino_adk_self_driving.png" width="100%" /></a></td><td>Transfer</td><td>上游 Agent 全对话</td><td>自主决策</td></tr>
<tr><td><strong>Sequential</strong></td><td>将用户提供的 SubAgents 列表,组合成按照顺序依次执行的 Sequential Agent,其中的 Name 和 Description 作为 Sequential Agent 的名称标识和描述。Sequential Agent 执行时,将 SubAgents 列表,按照顺序依次执行,直至将所有 Agent 执行一遍后结束。</td><td><a href="/img/eino/eino_adk_sequential_controller.png" target="_blank"><img src="/img/eino/eino_adk_sequential_controller.png" width="100%" /></a></td><td>Transfer</td><td>上游 Agent 全对话</td><td>预设决策</td></tr>
Expand All @@ -61,7 +61,7 @@ History 对应【上游 Agent 全对话上下文策略】,多 Agent 系统中

通过这种方式,其他 Agent 的行为被当作了提供给当前 Agent 的“外部信息”或“事实陈述”,而不是它自己的行为,从而避免了 LLM 的上下文混乱。

<a href="/img/eino/eino_adk_message_event.png" target="_blank"><img src="/img/eino/eino_adk_message_event.png" width="100%" /></a>
<a href="/img/eino/eino_adk_message_event.png" target="_blank"><img src="/img/eino/eino_adk_message_event.png" width="60%" /></a>

在 Eino ADK 中,当为一个 Agent 构建 AgentInput 时,它能看到的 History 是“所有在我之前产生的 AgentEvent”。

Expand All @@ -73,12 +73,12 @@ History 中每个 AgentEvent 都是由“特定 Agent 在特定的执行序列

下面表格中给出各种编排模式下,Agent 执行时的具体 RunPath:

<table>
<table class="bd-browser-bugs table table-bordered table-hover">
<tr><td>Example</td><td>RunPath</td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_sub_agent.png" target="_blank"><img src="/img/eino/eino_adk_run_path_sub_agent.png" width="100%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path.png" target="_blank"><img src="/img/eino/eino_adk_run_path.png" width="100%" /></a></td><td><li>Agent: [Agent]</li><li>Agent(after function call): [Agent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_sub_agent.png" target="_blank"><img src="/img/eino/eino_adk_run_path_sub_agent.png" width="20%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path.png" target="_blank"><img src="/img/eino/eino_adk_run_path.png" width="30%" /></a></td><td><li>Agent: [Agent]</li><li>Agent(after function call): [Agent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_collaboration_run_path_sequential.png" target="_blank"><img src="/img/eino/eino_adk_collaboration_run_path_sequential.png" width="100%" /></a></td><td><li>Agent1: [SequentialAgent, LoopAgent, Agent1]</li><li>Agent2: [SequentialAgent, LoopAgent, Agent1, Agent2]</li><li>Agent1: [SequentialAgent, LoopAgent, Agent1, Agent2, Agent1]</li><li>Agent2: [SequentialAgent, LoopAgent, Agent1, Agent2, Agent1, Agent2]</li><li>Agent3: [SequentialAgent, LoopAgent, Agent3]</li><li>Agent4: [SequentialAgent, LoopAgent, Agent3, ParallelAgent, Agent4]</li><li>Agent5: [SequentialAgent, LoopAgent, Agent3, ParallelAgent, Agent5]</li><li>Agent6: [SequentialAgent, LoopAgent, Agent3, ParallelAgent, Agent6]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_deterministic.png" target="_blank"><img src="/img/eino/eino_adk_run_path_deterministic.png" width="100%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li><li>Agent: [Agent, SubAgent, Agent]</li></td></tr>
<tr><td><a href="/img/eino/eino_adk_run_path_deterministic.png" target="_blank"><img src="/img/eino/eino_adk_run_path_deterministic.png" width="50%" /></a></td><td><li>Agent: [Agent]</li><li>SubAgent: [Agent, SubAgent]</li><li>Agent: [Agent, SubAgent, Agent]</li></td></tr>
</table>

#### 自定义
Expand Down Expand Up @@ -177,7 +177,7 @@ type OnSubAgents interface {

接下来以一个多功能对话 Agent 演示 Transfer 能力,目标是搭建一个可以查询天气或者与用户对话的 Agent,Agent 结构如下:

<a href="/img/eino/eino_adk_collaboration_example.png" target="_blank"><img src="/img/eino/eino_adk_collaboration_example.png" width="100%" /></a>
<a href="/img/eino/eino_adk_collaboration_example.png" target="_blank"><img src="/img/eino/eino_adk_collaboration_example.png" width="50%" /></a>

三个 Agent 均使用 ChatModelAgent 实现:

Expand Down Expand Up @@ -405,7 +405,7 @@ func AgentWithDeterministicTransferTo(_ context.Context, config *DeterministicTr

在 Supervisor 模式中,子 Agent 执行完毕后固定回到 Supervisor,由 Supervisor 生成下一步任务目标。此时可以使用 AgentWithDeterministicTransferTo:

<a href="/img/eino/eino_adk_deterministic_transfer.png" target="_blank"><img src="/img/eino/eino_adk_deterministic_transfer.png" width="100%" /></a>
<a href="/img/eino/eino_adk_deterministic_transfer.png" target="_blank"><img src="/img/eino/eino_adk_deterministic_transfer.png" width="70%" /></a>

```go
// github.com/cloudwego/eino/adk/prebuilt/supervisor.go
Expand Down Expand Up @@ -443,7 +443,7 @@ WorkflowAgent 支持以代码中预设好的流程运行 Agents。Eino ADK 提

SequentialAgent 会按照你提供的顺序,依次执行一系列 Agent:

<a href="/img/eino/eino_adk_sequential_agent.png" target="_blank"><img src="/img/eino/eino_adk_sequential_agent.png" width="100%" /></a>
<a href="/img/eino/eino_adk_sequential_agent.png" target="_blank"><img src="/img/eino/eino_adk_sequential_agent.png" width="80%" /></a>

```go
type SequentialAgentConfig struct {
Expand All @@ -459,7 +459,7 @@ func NewSequentialAgent(ctx context.Context, config *SequentialAgentConfig) (Age

LoopAgent 基于 SequentialAgent 实现,在 SequentialAgent 运行完成后,再次从头运行:

<a href="/img/eino/eino_adk_loop_definition.png" target="_blank"><img src="/img/eino/eino_adk_loop_definition.png" width="100%" /></a>
<a href="/img/eino/eino_adk_loop_definition.png" target="_blank"><img src="/img/eino/eino_adk_loop_definition.png" width="80%" /></a>

```go
type LoopAgentConfig struct {
Expand All @@ -477,7 +477,7 @@ func NewLoopAgent(ctx context.Context, config *LoopAgentConfig) (Agent, error)

ParallelAgent 会并发运行若干 Agent:

<a href="/img/eino/eino_adk_parallel_agent.png" target="_blank"><img src="/img/eino/eino_adk_parallel_agent.png" width="100%" /></a>
<a href="/img/eino/eino_adk_parallel_agent.png" target="_blank"><img src="/img/eino/eino_adk_parallel_agent.png" width="80%" /></a>

```go
type ParallelAgentConfig struct {
Expand Down