Highlights
Custom tool registration is now supported. Register tools at runtime without modifying the built-in registry:
runtime, err := api.New(ctx, api.Options{
CustomTools: []tool.Tool{myTool},
// ... other options
})Configuration simplified: Removed global config loading (~/.claude/). Projects now use only .claude/ directory for configuration, making deployment more predictable.
What's Changed
Added
- Custom tool registration via
api.WithCustomTools()option (pkg/api/agent.go:100-110) - Example 05: Custom tools demo (
examples/05-custom-tools/)
Changed
- BREAKING: Removed global configuration loading. SDK loads config only from project
.claude/directory (pkg/config/loader.go:45) - Core documentation translated to English (API reference, getting started, security guide)
Fixed
- File permission warnings: default mode changed from
0o644to0o600 - Removed unused
taskToolvariable in test files
Documentation
- README updated to reflect custom tool registration
- Custom tools guide consolidated and simplified
- Added comprehensive tool registration examples
亮点
自定义工具注册现已支持。在运行时注册工具,无需修改内置注册表:
runtime, err := api.New(ctx, api.Options{
CustomTools: []tool.Tool{myTool},
// ... 其他选项
})配置简化:移除全局配置加载(~/.claude/)。项目现仅使用 .claude/ 目录配置,使部署更可预测。
变更内容
新增
- 通过
api.WithCustomTools()选项支持自定义工具注册(pkg/api/agent.go:100-110) - 示例 05:自定义工具演示(
examples/05-custom-tools/)
变更
- 破坏性变更:移除全局配置加载。SDK 仅从项目
.claude/目录加载配置(pkg/config/loader.go:45) - 核心文档翻译为英文(API 参考、入门指南、安全指南)
修复
- 文件权限警告:默认权限从
0o644改为0o600 - 移除测试文件中未使用的
taskTool变量
文档
- 更新 README 以反映自定义工具注册功能
- 精简并整合自定义工具指南
- 添加完整的工具注册示例
Installation
go get github.com/cexll/agentsdk-go@v0.3.0Migration from 0.2.x
If you relied on global config (~/.claude/settings.json), move your configuration to the project-level .claude/settings.json. The SDK no longer reads from the home directory.
从 0.2.x 迁移
如果依赖全局配置(~/.claude/settings.json),请将配置迁移到项目级 .claude/settings.json。SDK 不再读取主目录配置。
Full Changelog: 0.2...0.3