20260514:增加新内容
This commit is contained in:
32
concepts/tool-registry.md
Normal file
32
concepts/tool-registry.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: "ToolRegistry"
|
||||
created: 2026-05-11
|
||||
updated: 2026-05-11
|
||||
type: concept
|
||||
tags: [agent-architecture, tool-design, api]
|
||||
sources: [[prompt-caching-architecture]]
|
||||
---
|
||||
|
||||
# ToolRegistry
|
||||
|
||||
## 定义
|
||||
|
||||
ToolRegistry 是 [[stub-pattern|Stub 模式]] 中的核心组件,提供统一的工具调用接口。Agent 通过 ToolRegistry 间接调用具体工具,而非直接与工具定义交互。
|
||||
|
||||
## 工作流程
|
||||
|
||||
1. Agent 决策:调用 `ToolRegistry.invoke("fetch_factor_data", {ticker: "AAPL", time_range: "1d"})`
|
||||
2. ToolRegistry 解析工具标识符,查找对应实现
|
||||
3. 动态加载/执行具体逻辑,返回结果
|
||||
4. 对 Agent 而言,ToolRegistry 的定义在会话中**从未改变**
|
||||
|
||||
## 工程价值
|
||||
|
||||
- 隔离工具定义变更对缓存的影响
|
||||
- 支持运行时动态注册/卸载工具(对缓存透明)
|
||||
- 统一错误处理和日志记录入口
|
||||
|
||||
## 相关概念
|
||||
|
||||
- [[stub-pattern|Stub 模式]]
|
||||
- [[prompt-caching|Prompt Caching]]
|
||||
Reference in New Issue
Block a user