This document describes the Agent component's tool integration system and its implementation of the ReAct (Reasoning + Acting) pattern for multi-step problem-solving. The Agent component orchestrates iterative workflows where language models reason about tasks, invoke external tools, observe results, and synthesize final answers.
For general information about the Canvas workflow system and component architecture, see Canvas Engine and DSL (8.1) and Component System Architecture (8.2). For details on the base LLM component without tool use, see Built-in Components (8.3).
The Agent component is a specialized LLM component that implements ReAct-style tool use. Unlike a standard LLM component that generates single-shot text responses, the Agent can analyze tasks, plan actions by selecting tools, and reflect on observations to determine next steps.
| Feature | LLM Component | Agent Component |
|---|---|---|
| Tool access | None | Built-in, MCP, and Sub-Agents |
| Iterations | Single-shot | Multi-turn (max_rounds) |
| Tool Card UI | Not applicable | Renders as ToolCard in ToolNode web/src/pages/agent/canvas/node/tool-node.tsx81 |
The frontend manages tool configuration through specialized forms. The AgentNode component handles visual handles for tools (bottom-left at position 20) and sub-agents (bottom-right at position 180) web/src/pages/agent/canvas/node/agent-node.tsx71-90 It also visualizes the failure handling method, such as Goto which adds an error handle web/src/pages/agent/canvas/node/agent-node.tsx104-115
Sources: web/src/pages/agent/canvas/node/agent-node.tsx71-115 web/src/pages/agent/canvas/node/tool-node.tsx81-103
The Agent architecture bridges the gap between high-level LLM reasoning and low-level code execution by mapping model tool-calls to specific Python/Go objects or remote MCP sessions.
Title: Natural Language Space to Code Entity Space: Tool Mapping
Sources: internal/agent/tool/registry.go33-68 internal/agent/component/universe_a_wrappers.go126-138 agent/tools/exesql.py70 agent/tools/code_exec.py29 agent/tools/retrieval.py82 web/src/pages/agent/canvas/node/retrieval-node.tsx20 web/src/pages/agent/canvas/node/switch-node.tsx64
Built-in tools are specialized modules that the Agent can invoke.
Key Tools:
rag_flow database agent/tools/exesql.py60-64 and guards against SSRF via assert_host_is_safe agent/tools/exesql.py124select_business_output to isolate the primary result from system metadata agent/tools/code_exec.py64-74similarity_threshold, top_n, and meta_data_filter agent/tools/retrieval.py37-72 The _retrieve_kb method handles resolving dataset IDs from variables and applying metadata filters agent/tools/retrieval.py90-137Sources: agent/tools/exesql.py70-128 agent/tools/code_exec.py64-199 agent/tools/retrieval.py37-137 web/src/pages/agent/form/switch-form/index.tsx153-200 web/src/pages/agent/canvas/node/switch-node.tsx32-43
The Go port implements a centralized tool registry in internal/agent/tool/registry.go internal/agent/tool/registry.go33 This registry uses a Factory pattern internal/agent/tool/registry.go31 to build Eino-compatible BaseTool instances. The registry includes 20+ built-in tools.
Registered Tools include:
arxiv, duckduckgo, google, google_scholar, wikipedia, searxng, tavily, bgpt internal/agent/tool/registry.go33-60code_exec (Sandbox execution) internal/agent/tool/registry.go37 execute_sql / exesql (Database access) internal/agent/tool/registry.go42-43 github internal/agent/tool/registry.go44retrieval / search_my_dataset internal/agent/tool/registry.go52-54yahoo_finance, akshare, tushare, wencai, jin10 internal/agent/tool/registry.go34-67email internal/agent/tool/registry.go41 deepl internal/agent/tool/registry.go39 qweather internal/agent/tool/registry.go51 pubmed internal/agent/tool/registry.go50Sources: internal/agent/tool/registry.go33-68 internal/agent/tool/registry.go70-117
The Agent's reasoning process follows the ReAct pattern, iteratively calling tools until a final answer is produced.
Title: Agent Tool Connectivity in Canvas
Sources: web/src/pages/agent/canvas/node/agent-node.tsx71-90 web/src/pages/agent/canvas/node/retrieval-node.tsx36-48 internal/agent/component/universe_a_wrappers.go167-183 internal/agent/runtime/state.go27-40
Retrieval and CodeExec in the component registry internal/agent/component/universe_a_wrappers.go17-20kb_ids or query) from the canvas context. In Go, retrievalComponent applies defaults and normalizes legacy inputs internal/agent/component/universe_a_wrappers.go168-169Invoke method internal/agent/component/universe_a_wrappers.go167 executes the underlying tool. For instance, retrievalComponent calls inner.InvokableRun with marshaled JSON arguments internal/agent/component/universe_a_wrappers.go175parseToolEnvelope handles the envelope extraction internal/agent/component/universe_a_wrappers.go182CanvasState with its RWMutex internal/agent/runtime/state.go27-40Sources: internal/agent/component/universe_a_wrappers.go17-183 agent/tools/retrieval.py90-105 internal/agent/runtime/state.go27-40
Tools generally provide two types of outputs to satisfy both the LLM and the workflow:
Retrieval, this includes id, document_id, and score internal/agent/component/universe_a_wrappers.go163 web/src/pages/agent/form/retrieval-form/next.tsx148The Retrieval tool supports complex metadata filtering. It uses DocMetadataService.get_flatted_meta_by_kbs agent/tools/retrieval.py137 to fetch available metadata and applies filters using a variable reference pattern agent/tools/retrieval.py145 The frontend provides a MetadataFilter component that supports variable referencing web/src/pages/agent/form/retrieval-form/next.tsx182
Sources: agent/tools/retrieval.py44-137 internal/agent/component/universe_a_wrappers.go160-165 web/src/pages/agent/form/retrieval-form/next.tsx141-182
Refresh this wiki
This wiki was recently refreshed. Please wait 4 days to refresh again.