Skip to content

Commit 1b07b4c

Browse files
docs: 更新 README 文档,新增 ADK 智能体开发套件介绍
- 在概述中新增 ADK 一行介绍 - 重构 ReAct 部分,将编排能力说明前移,使用 ADK ChatModelAgent 示例替换旧实现 - 新增 ADK 详细功能展示:多智能体上下文管理、中断/恢复机制、预置模式、中间件系统 - 在关键特性中新增智能体开发套件(ADK)章节 - 将切面(Callbacks)合并到强大的编排章节 - 更新框架结构图链接 - 同步更新中英文 README Change-Id: I0ae5a325f390d781dbae01f852aaeb8c1dc412e7
1 parent 520e4d8 commit 1b07b4c

File tree

7 files changed

+231
-40
lines changed

7 files changed

+231
-40
lines changed
784 KB
Loading
-354 KB
Binary file not shown.
-617 KB
Binary file not shown.
445 KB
Loading

.github/static/img/eino/react.png

-229 KB
Loading

README.md

Lines changed: 112 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ English | [中文](README.zh_CN.md)
1414

1515
# Overview
1616

17-
**Eino['aino]** (pronounced similarly to "I know") aims to be the ultimate LLM application development framework in Golang. Drawing inspirations from many excellent LLM application development frameworks in the open-source community such as LangChain & LlamaIndex, etc., as well as learning from cutting-edge research and real world applications, Eino offers an LLM application development framework that emphasizes on simplicity, scalability, reliability and effectiveness that better aligns with Golang programming conventions.
17+
**Eino['aino]** (pronounced similarly to "I know") aims to be the ultimate LLM application development framework in Golang. Drawing inspirations from many excellent LLM application development frameworks in the open-source community such as LangChain & Google ADK, etc., as well as learning from cutting-edge research and real world applications, Eino offers an LLM application development framework that emphasizes on simplicity, scalability, reliability and effectiveness that better aligns with Golang programming conventions.
1818

1919
What Eino provides are:
2020
- a carefully curated list of **component** abstractions and implementations that can be easily reused and combined to build LLM applications
2121
- a powerful **composition** framework that does the heavy lifting of strong type checking, stream processing, concurrency management, aspect injection, option assignment, etc. for the user.
22+
- an **Agent Development Kit (ADK)** that provides high-level abstractions for building AI agents with multi-agent orchestration, human-in-the-loop interrupts, and prebuilt agent patterns.
2223
- a set of meticulously designed **API** that obsesses on simplicity and clarity.
2324
- an ever-growing collection of best practices in the form of bundled **flows** and **examples**.
2425
- a useful set of tools that covers the entire development cycle, from visualized development and debugging to online tracing and evaluation.
@@ -140,13 +141,7 @@ our, err := runnable.Invoke(ctx, []*schema.Message{
140141
})
141142
```
142143

143-
Now let's create a 'ReAct' agent: A ChatModel binds to Tools. It receives input Messages and decides independently whether to call the Tool or output the final result. The execution result of the Tool will again become the input Message for the ChatModel and serve as the context for the next round of independent judgment.
144-
145-
![](.github/static/img/eino/react.png)
146-
147-
We provide a complete implementation for ReAct Agent out of the box in the `flow` package. Check out the code here: [flow/agent/react](https://github.com/cloudwego/eino/blob/main/flow/agent/react/react.go)
148-
149-
Our implementation of ReAct Agent uses Eino's **graph orchestration** exclusively, which provides the following benefits out of the box:
144+
Eino's **graph orchestration** provides the following benefits out of the box:
150145
- Type checking: it makes sure the two nodes' input and output types match at compile time.
151146
- Stream processing: concatenates message stream before passing to chatModel and toolsNode if needed, and copies the stream into callback handlers.
152147
- Concurrency management: the shared state can be safely read and written because the StatePreHandler is concurrency safe.
@@ -181,6 +176,103 @@ compiledGraph.Invoke(ctx, input, WithChatModelOption(WithTemperature(0.5))
181176
compiledGraph.Invoke(ctx, input, WithCallbacks(handler).DesignateNode("node_1"))
182177
```
183178

179+
Now let's create a 'ReAct' agent: A ChatModel binds to Tools. It receives input Messages and decides independently whether to call the Tool or output the final result. The execution result of the Tool will again become the input Message for the ChatModel and serve as the context for the next round of independent judgment.
180+
181+
![](.github/static/img/eino/react.png)
182+
183+
Eino's **Agent Development Kit (ADK)** provides `ChatModelAgent` that implements this pattern out of the box:
184+
185+
```Go
186+
agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
187+
Name: "assistant",
188+
Description: "A helpful assistant that can use tools",
189+
Model: chatModel,
190+
ToolsConfig: adk.ToolsConfig{
191+
ToolsNodeConfig: compose.ToolsNodeConfig{
192+
Tools: []tool.BaseTool{weatherTool, calculatorTool},
193+
},
194+
},
195+
})
196+
197+
runner := adk.NewRunner(ctx, adk.RunnerConfig{Agent: agent})
198+
iter := runner.Query(ctx, "What's the weather in Beijing this weekend?")
199+
for {
200+
event, ok := iter.Next()
201+
if !ok {
202+
break
203+
}
204+
// process agent events (model outputs, tool calls, etc.)
205+
}
206+
```
207+
208+
The ADK handles the ReAct loop internally, emitting events for each step of the agent's reasoning process.
209+
210+
Beyond the basic ReAct pattern, ADK provides powerful capabilities for building production-ready agent systems:
211+
212+
**Multi-Agent with Context Management**: Agents can transfer control to sub-agents or be wrapped as tools. The framework automatically manages conversation context across agent boundaries:
213+
214+
```Go
215+
// Set up agent hierarchy - mainAgent can now transfer to sub-agents
216+
mainAgentWithSubs, _ := adk.SetSubAgents(ctx, mainAgent, []adk.Agent{researchAgent, codeAgent})
217+
```
218+
219+
When `mainAgent` transfers to `researchAgent`, the conversation history is automatically rewritten to provide appropriate context for the sub-agent.
220+
221+
Agents can also be wrapped as tools, allowing one agent to invoke another as part of its tool-calling workflow:
222+
223+
```Go
224+
// Wrap an agent as a tool that can be called by other agents
225+
researchTool := adk.NewAgentTool(ctx, researchAgent)
226+
```
227+
228+
**Interrupt Anywhere, Resume Directly**: Any agent can pause execution for human approval or external input, and resume exactly where it left off:
229+
230+
```Go
231+
// Inside a tool or agent, trigger an interrupt
232+
return adk.Interrupt(ctx, "Please confirm this action")
233+
234+
// Later, resume from checkpoint
235+
iter, _ := runner.Resume(ctx, checkpointID)
236+
```
237+
238+
**Prebuilt Agent Patterns**: Ready-to-use implementations for common architectures:
239+
240+
```Go
241+
// Deep Agent: battle-tested pattern for complex task orchestration with
242+
// built-in task management, sub-agent delegation, and progress tracking
243+
deepAgent, _ := deep.New(ctx, &deep.Config{
244+
Name: "deep_agent",
245+
Description: "An agent that breaks down and executes complex tasks",
246+
ChatModel: chatModel,
247+
SubAgents: []adk.Agent{researchAgent, codeAgent},
248+
ToolsConfig: adk.ToolsConfig{...},
249+
})
250+
251+
// Supervisor pattern: one agent coordinates multiple specialists
252+
supervisorAgent, _ := supervisor.New(ctx, &supervisor.Config{
253+
Supervisor: coordinatorAgent,
254+
SubAgents: []adk.Agent{writerAgent, reviewerAgent},
255+
})
256+
257+
// Sequential execution: agents run one after another
258+
seqAgent, _ := adk.NewSequentialAgent(ctx, &adk.SequentialAgentConfig{
259+
SubAgents: []adk.Agent{plannerAgent, executorAgent, summarizerAgent},
260+
})
261+
```
262+
263+
**Extensible Middleware System**: Add capabilities to agents without modifying their core logic:
264+
265+
```Go
266+
fsMiddleware, _ := filesystem.NewMiddleware(ctx, &filesystem.Config{
267+
Backend: myFileSystem,
268+
})
269+
270+
agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
271+
// ...
272+
Middlewares: []adk.AgentMiddleware{fsMiddleware},
273+
})
274+
```
275+
184276
# Key Features
185277

186278
## Rich Components
@@ -201,7 +293,18 @@ compiledGraph.Invoke(ctx, input, WithCallbacks(handler).DesignateNode("node_1"))
201293
- Graph orchestration is powerful and flexible enough to implement complex business logic:
202294
- type checking, stream processing, concurrency management, aspect injection and option assignment are handled by the framework.
203295
- branch out execution at runtime, read and write global state, or do field level data mapping using workflow(currently in alpha stage).
296+
- **Aspects (Callbacks)** handle cross-cutting concerns such as logging, tracing, and metrics. Five aspects are supported: OnStart, OnEnd, OnError, OnStartWithStreamInput, OnEndWithStreamOutput. Custom callback handlers can be added during graph run via options.
297+
298+
## Agent Development Kit (ADK)
204299

300+
While graph orchestration gives you fine-grained control, the **ADK** package provides higher-level abstractions optimized for building AI agents:
301+
302+
- **ChatModelAgent**: A ReAct-style agent that handles tool calling, conversation state, and the reasoning loop automatically.
303+
- **Multi-Agent with Context Engineering**: Build hierarchical agent systems where conversation history is automatically managed across agent transfers and agent-as-tool invocations, enabling seamless context sharing between specialized agents.
304+
- **Workflow Agents**: Compose agents using `SequentialAgent`, `ParallelAgent`, and `LoopAgent` for complex execution flows.
305+
- **Human-in-the-Loop**: `Interrupt` and `Resume` mechanisms with checkpoint persistence for workflows requiring human approval or input.
306+
- **Prebuilt Patterns**: Ready-to-use implementations including Deep Agent (task orchestration), Supervisor (hierarchical coordination), and Plan-Execute-Replan.
307+
- **Agent Middlewares**: Extensible middleware system for adding tools (filesystem operations) and managing context (token reduction).
205308

206309
## Complete Stream Processing
207310

@@ -221,20 +324,13 @@ compiledGraph.Invoke(ctx, input, WithCallbacks(handler).DesignateNode("node_1"))
221324
| Collect | Accepts stream type StreamReader[I] and returns non-stream type O |
222325
| Transform | Accepts stream type StreamReader[I] and returns stream type StreamReader[O] |
223326

224-
## Highly Extensible Aspects (Callbacks)
225-
226-
- Aspects handle cross-cutting concerns such as logging, tracing, metrics, etc., as well as exposing internal details of component implementations.
227-
- Five aspects are supported: **OnStart, OnEnd, OnError, OnStartWithStreamInput, OnEndWithStreamOutput**.
228-
- Developers can easily create custom callback handlers, add them during graph run via options, and they will be invoked during graph run.
229-
- Graph can also inject aspects to those component implementations that do not support callbacks on their own.
230-
231327
# Eino Framework Structure
232328

233329
![](.github/static/img/eino/eino_framework.jpeg)
234330

235331
The Eino framework consists of several parts:
236332

237-
- Eino(this repo): Contains Eino's type definitions, streaming mechanism, component abstractions, orchestration capabilities, aspect mechanisms, etc.
333+
- Eino(this repo): Contains Eino's type definitions, streaming mechanism, component abstractions, orchestration capabilities, agent implementations, aspect mechanisms, etc.
238334

239335
- [EinoExt](https://github.com/cloudwego/eino-ext): Component implementations, callback handlers implementations, component usage examples, and various tools such as evaluators, prompt optimizers.
240336

0 commit comments

Comments
 (0)