跳到主要内容

AgentGo - 我学习 OpenClaw 架构开发的迷你 Agent 框架

勾玉aniki
博客作者,py&go后端开发,爱好动漫。邮箱tangssst@qq.com

AgentGo 是一个基于 OpenClaw 架构设计的轻量级通用 Agent 框架,使用 Go 语言实现。它设计目标是领域通用、可靠稳定、简单易用、高度可扩展,可作为学习现代 Agent 架构的绝佳起点,也可直接用于生产环境中的智能任务自动化场景。

项目地址

🔗 GitHub: https://github.com/Bronya0/AgentGo

核心特性

🎯 领域通用

  • 多模型支持:兼容 OpenAI、Anthropic 等多种 LLM 提供商
  • 模型路由:按任务复杂度自动选择合适的模型(快速/均衡/强大三档)
  • 灵活配置:支持单 provider 和多 provider 混合模式

🔧 高度可扩展

  • Skill 系统:易于添加自定义技能模块
  • Tool 集成:原生支持函数调用和工具链编排
  • 插件架构:支持自定义插件扩展核心功能

⚡ 开箱即用

  • CLI 交互:支持单次对话和交互式 Shell 模式
  • HTTP Server:内置 REST API 服务器
  • Debug 支持:完整的日志和调试工具链

🛡️ 生产就绪

  • 错误处理和重试机制
  • 上下文管理和会话保持
  • 性能优化和并发支持

快速开始

编译

cd src
go build -o agent ./cmd/agent/

配置

src/config.example.yaml 复制为 src/config.yaml,填入你的 LLM API 信息:

单 Provider 模式

provider:
type: openai
base_url: "https://api.openai.com/v1"
api_key: "${OPENAI_API_KEY}" # 支持环境变量
model: "gpt-4o"

多模型路由模式

providers:
- id: fast
model: gpt-4o-mini
tier: fast # 简单问答
- id: balanced
model: gpt-4o
tier: balanced # 常规任务(默认)
- id: powerful
model: o1-preview
tier: powerful # 复杂推理

运行

# 单次对话模式
./agent -chat "帮我列出当前目录下的所有 Go 文件"

# 启动 HTTP 服务器
./agent

# 启用 Debug 日志
./agent -debug

项目结构

AgentGo/
├── cmd/
│ └── agent/ # 主程序入口
├── internal/
│ ├── agent/ # Agent 核心逻辑
│ ├── llm/ # LLM 提供商接口
│ ├── tools/ # 工具函数库
│ └── config/ # 配置管理
├── skills/ # Skill 模块(可扩展)
├── config.yaml # 运行配置
└── go.mod # 依赖管理

架构设计

AgentGo 遵循 OpenClaw 架构理念,是一套完整的分层设计系统。

OpenClaw 架构的核心思想

OpenClaw 的设计哲学是关注点分离:将复杂的 Agent 智能体分解为若干独立的层级,每层只负责特定的职责,通过明确的接口进行通信。这种设计使得系统易于扩展、测试和维护。

User Input

[Entry Point Layer] - CLI/HTTP 入口

[Agent Orchestration] - Agent 核心业务逻辑

[LLM Provider Abstraction] - LLM 提供商适配层

[Tool/Skill Execution] - 工具和技能执行层

[External Systems] - 外部系统集成

1. LLM 提供商抽象层

这是 AgentGo 的核心竞争力。设计目标是用统一接口屏蔽不同 LLM 提供商的差异。

关键设计

  • 接口定义:定义标准的 LLMProvider 接口,包括 Chat()ChatStream()EmbedText() 等方法
  • 多提供商支持:通过工厂模式创建不同的提供商实现(OpenAI、Claude、DeepSeek、阿里云等)
  • 流式响应:使用 Go Channel 实现流式处理,支持实时推送 Token
type LLMProvider interface {
// 单次调用,返回完整响应
Chat(ctx context.Context, messages []Message) (string, error)

// 流式调用,通过 channel 推送 token
ChatStream(ctx context.Context, messages []Message) (<-chan string, error)

// 向量化文本
EmbedText(ctx context.Context, text string) ([]float32, error)
}

特点

  • ✅ 零成本抽象 - Go 接口不会产生运行时开销
  • ✅ 动态切换 - 无需重新编译可切换提供商
  • ✅ 错误恢复 - 内置 Fallback 机制

2. 多模型路由系统

这是解决"模型选择困境"的关键。不同模型在成本、速度、能力方面差异巨大,smart routing 可以显著提升系统效能。

路由算法

providers:
- id: fast
model: gpt-4o-mini
tier: fast
cost_per_1m_tokens: 0.15
latency_ms: 100-200
capability_score: 70

- id: balanced
model: gpt-4o
tier: balanced
cost_per_1m_tokens: 5.0
latency_ms: 200-500
capability_score: 95

- id: powerful
model: o1-preview
tier: powerful
cost_per_1m_tokens: 15.0
latency_ms: 1000-3000
capability_score: 99

路由决策规则

if task.complexity_score < 3:
use_model = fast_tier
# 简单QA、信息检索、模板填充
else if task.complexity_score < 7:
use_model = balanced_tier
# 常规代码生成、文本摘要、表格处理
else:
use_model = powerful_tier
# 复杂推理、架构设计、问题分析

复杂度评分机制

  • 基于输入长度:token_count / 1000
  • 基于关键词匹配:是否包含"设计"、"分析"、"算法"等复杂词汇
  • 基于历史重试次数:前一个模型失败则升级
  • 基于用户指定:显式声明 @fast@powerful 标签

3. Agent 核心循环

Agent 的智能本质是一个反馈循环:

Step 1: 理解
Parse user input → 提取意图、参数、上下文

Step 2: 规划
LLM reasoning → 分析需要的工具/技能
生成 Tool Calls 列表

Step 3: 执行
for each tool_call:
执行对应的 Tool/Skill
捕获执行结果
处理异常和超时

Step 4: 反思
收集执行结果
判断是否达成目标
if NOT:
更新 context with results
回到 Step 2 (最多重试 N 次)
else:
生成最终响应

代码伪示例

func (agent *Agent) Run(ctx context.Context, userInput string) (string, error) {
for attempt := 0; attempt < maxRetries; attempt++ {
// Step 2: 规划
toolCalls, err := agent.llm.GetToolCalls(ctx, agent.history)
if err != nil {
return "", err
}

// Step 3: 执行
results := make([]ToolResult, 0)
for _, call := range toolCalls {
result := agent.executeToolCall(ctx, call)
results = append(results, result)
}

// Step 4: 反思
if agent.isGoalAchieved(results) {
return agent.generateFinalResponse(results)
}

agent.history.AddAssistantMessage(toolCalls)
agent.history.AddToolResults(results)
}
return "", errors.New("max retries exceeded")
}

4. 函数调用系统 (Function Calling)

这是 Agent 能力的核心。现代 LLM 原生支持 Function Calling,Agent 利用这个能力来调用外部工具。

OpenAI Function Calling 协议

{
"type": "function",
"function": {
"name": "get_file_list",
"description": "列出目录下的所有文件",
"parameters": {
"type": "object",
"properties": {
"directory": {
"type": "string",
"description": "要列出的目录路径"
},
"recursive": {
"type": "boolean",
"description": "是否递归列出子目录"
}
},
"required": ["directory"]
}
}
}

AgentGo 的 Tool 定义

type Tool struct {
Name string // 工具名称
Description string // 工具描述
Parameters []Parameter // 参数定义
Handler func(...) error // 实际执行函数
}

type Parameter struct {
Name string
Type string // "string" | "number" | "boolean" | "array"
Description string
Required bool
}

工具注册和调用流程

  1. 启动时注册:系统启动时,所有 Tool 和 Skill 扫描并注册
  2. 传递给 LLM:将 Tool Schema 作为系统提示词传给 LLM
  3. LLM 决策:LLM 判断需要调用哪些工具,生成 tool_use 消息
  4. 执行和反馈:Agent 执行工具,将结果返回给 LLM,LLM 继续决策

5. Skill 系统设计

Skill 是对一类相关操作的抽象。和 Tool(低级函数调用)不同,Skill 是高级的、可组合的能力。

Skill vs Tool 对比

特性ToolSkill
粒度细粒度(单一函数)粗粒度(一类操作)
复杂度无状态、快速可有状态、可复杂
可组合性通过工具链组合通过工作流组合
示例read_filehttp_get代码审查Skill数据分析Skill

Skill 接口定义

type Skill interface {
// 技能名称
Name() string

// 技能描述
Description() string

// 注册本技能的所有 Tool
RegisterTools() []Tool

// 执行逻辑(可选,复杂业务逻辑)
Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)

// 检查前置条件
CanHandle(input string) bool
}

Skill 加载机制(动态加载):

skillManager := NewSkillManager()
skillManager.RegisterSkill(new(CodeReviewSkill))
skillManager.RegisterSkill(new(DataAnalysisSkill))

// 运行时动态加载插件
if enablePlugin {
skillManager.LoadFromPlugin("/plugins/custom_skill.so")
}

6. 上下文和会话管理

Agent 的"记忆"就是上下文 (Context)。有效的上下文管理决定了 Agent 能否进行长对话。

上下文结构

type ConversationContext struct {
// 消息历史
Messages []Message // [{role, content, tool_calls}, ...]

// 用户信息和会话状态
SessionID string
UserID string
CreatedAt time.Time
LastModifiedAt time.Time

// 工具执行历史(用于分析工具链)
ToolExecutions []ToolExecution

// 性能指标
TotalTokens int
TotalCost float64

// 业务上下文
Variables map[string]interface{} // 存储中间变量
}

Token 窗口管理(关键):

LLM 有 token 限制(如 GPT-4 是 8k/128k)。当历史对话超过限制时,需要压缩或删除旧消息:

func (ctx *ConversationContext) TrimIfNeeded(maxTokens int) error {
currentTokens := ctx.CountTokens()

if currentTokens < maxTokens {
return nil
}

// 策略1: 移除最早的消息(FIFO)
for currentTokens >= maxTokens && len(ctx.Messages) > 1 {
ctx.Messages = ctx.Messages[1:]
currentTokens = ctx.CountTokens()
}

// 策略2: 使用摘要替代旧消息
if currentTokens >= maxTokens {
summary := summarizeOldMessages(ctx.Messages[:maxLen])
ctx.Messages = append(
[]Message{{Role: "system", Content: summary}},
ctx.Messages[maxLen:]...,
)
}

return nil
}

7. 并发处理和性能优化

Go 的 goroutine 是实现高效并发的利器。AgentGo 在多个层面优化:

并发工具执行

func (agent *Agent) ExecuteToolsParallel(ctx context.Context, calls []ToolCall) []ToolResult {
resultChan := make(chan ToolResult, len(calls))

// 并发执行所有工具调用
for _, call := range calls {
go func(call ToolCall) {
result := agent.executeToolCall(ctx, call)
resultChan <- result
}(call)
}

// 收集结果
results := make([]ToolResult, 0, len(calls))
for i := 0; i < len(calls); i++ {
results = append(results, <-resultChan)
}

return results
}

流式响应优化

func (h *HTTPHandler) handleChat(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/event-stream")

// 设置 SSE (Server-Sent Events)
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")

flusher := w.(http.Flusher)

// 从 LLM 流接收 token
tokenChan, _ := agent.llm.ChatStream(ctx, messages)

for token := range tokenChan {
fmt.Fprintf(w, "data: %s\n\n", token)
flusher.Flush() // 实时推送到客户端
}
}

缓存策略

  • LLM Response Cache:相同输入缓存 LLM 结果(5 分钟 TTL)
  • Embedding Cache:文本向量化结果缓存(长期)
  • Tool Result Cache:一些工具结果缓存(如文件列表)至少 1 使用context/deadline 控制超时

8. 错误处理和重试机制

Agent 的健壮性依赖于完善的错误处理。AgentGo 采用分层的重试策略:

重试分类

type ErrorType int

const (
// 可重试错误
RateLimitError ErrorType = iota // 431 Too Many Requests
TimeoutError // 超时
TemporaryNetError // 临时网络错误

// 不可重试错误
AuthenticationError // 401/403
InvalidToolError // tool 不存在
UserInputError // 用户输入格式错误
)

func (agent *Agent) RetryableCall(ctx context.Context, call ToolCall) ToolResult {
backoff := time.Millisecond * 100
maxRetries := 3

for attempt := 0; attempt < maxRetries; attempt++ {
result := agent.executeToolCall(ctx, call)

if result.Error == nil {
return result
}

if !isRetryableError(result.Error) {
return result // 不可重试的错误,直接返回
}

if attempt < maxRetries-1 {
select {
case <-time.After(backoff):
case <-ctx.Done():
return result
}
backoff *= 2 // 指数退避
}
}

return result
}

9. 实现细节:Message 格式与版本управления

不同 LLM 提供商对消息格式要求差异大。AgentGo 通过规范化中间表示来处理这个问题:

统一的消息格式

type Message struct {
Role string // "user" | "assistant" | "system" | "tool"
Content string // 主要内容

// Tool Call(assistant message 才有)
ToolCalls []ToolCall

// Tool Result(tool message 才有)
ToolResults []ToolResult

// Metadata
Timestamp time.Time
Model string // 该消息用哪个模型生成
}

type ToolCall struct {
ID string // 唯一ID,用于配对结果
Name string // 工具名称
Arguments map[string]interface{} // 传入参数
}

供应商适配示例 (OpenAI vs Claude)

// OpenAI 格式
func (provider *OpenAIAdapter) ToOpenAIFormat(msgs []Message) []openai.ChatCompletionMessage {
var result []openai.ChatCompletionMessage
for _, msg := range msgs {
if msg.Role == "tool" {
// OpenAI 的 tool result 格式
result = append(result, openai.ChatCompletionMessage{
Role: "tool",
Content: msg.Content,
ToolCallID: msg.ToolResults[0].ID,
})
} else {
result = append(result, openai.ChatCompletionMessage{
Role: msg.Role,
Content: msg.Content,
})
}
}
return result
}

// Claude 格式
func (provider *ClaudeAdapter) ToClaudeFormat(msgs []Message) []claude.Message {
// Claude 的 API 要求不同的结构...
}

10. 成本控制和监付费化

在生产环境,LLM API 的成本可能很高。AgentGo 内置成本监控:

成本跟踪

type CostTracker struct {
sessionID string
totalCost float64
costByModel map[string]float64
costBySkill map[string]float64
startTime time.Time
}

func (tracker *CostTracker) RecordLLMCall(model string, inputTokens, outputTokens int) {
// 从配置读取定价表
costPerInput := pricingTable[model][input_1k]
costPerOutput := pricingTable[model][output_1k]

cost := float64(inputTokens)/1000*costPerInput +
float64(outputTokens)/1000*costPerOutput

tracker.totalCost += cost
tracker.costByModel[model] += cost

// 成本限制检查
if tracker.totalCost > budgetLimit {
log.Warn("Cost budget exceeded!", tracker.totalCost)
}
}

成本优化建议

  • 用便宜模型做初步分析,仅在必要时才升级到高级模型
  • 缓存频繁的 LLM 调用结果
  • 使用 mini 模型处理简单任务
  • Token 窗口管理防止输入费用爆炸

11. Prompt Engineering 最佳实践

Agent 的效果很大程度上取决于 Prompt 质量。AgentGo 采用的最佳实践:

System Prompt 结构

你是一个智能代理,可以使用以下工具完成任务。

[工具清单]
- 工具1:描述
- 工具2:描述

[使用规则]
1. 逐步思考,分解为多个步骤
2. 使用工具时,严格遵循参数格式
3. 如果工具执行失败,尝试替代方案

[输出格式]
使用 JSON 格式返回结果。

[约束条件]
- 不能访问网络(除非明确授权)
- 不能修改系统文件
- 超时时间:30 秒

动态 Prompt 组装

func (agent *Agent) BuildSystemPrompt() string {
var sb strings.Builder

sb.WriteString("你是一个智能 Agent。\n\n")

// 动态添加可用的工具列表
sb.WriteString("<tools>\n")
for _, tool := range agent.availableTools {
sb.WriteString(fmt.Sprintf(`
Tool: %s
Description: %s
Parameters: %v
`, tool.Name, tool.Description, tool.Parameters))
}
sb.WriteString("</tools>\n")

// 添加用户自定义的 instructions
sb.WriteString(agent.customInstructions)

return sb.String()
}

12. 监控、日志和调试

生产环境需要完善的可观测性(Observability)。

关键 metrics

type AgentMetrics struct {
// 吞吐量
RequestsPerSecond float64

// 延迟
P50Latency time.Duration
P95Latency time.Duration
P99Latency time.Duration

// 成功率
SuccessRate float64

// Token 使用
AvgTokensPerRequest int
TotalTokensUsed int64

// 成本
TotalCost float64
CostTrend []float64 // 最近 24 小时

// 工具使用
ToolUsageCount map[string]int
ToolErrorRate map[string]float64
}

结构化日志示例

agent.logger.WithFields(log.Fields{
"session_id": ctx.SessionID,
"user_id": ctx.UserID,
"tool_name": call.Name,
"latency_ms": elapsed.Milliseconds(),
"error": result.Error,
"cost": cost,
}).Info("tool_execution_completed")

使用场景

任务自动化 - 自动化处理重复性工作
代码生成 - 辅助编程和代码审查
数据分析 - 智能数据处理和报告生成
知识库查询 - 构建企业级 AI 助手
工作流编排 - 复杂流程自动化

生产级别的实现挑战与解决方案

Challenge 1: 幻觉问题(Hallucination)

LLM 有时会编造不存在的工具或参数。

解决方案

// 严格验证工具调用
func (agent *Agent) ValidateToolCall(call ToolCall) error {
tool, exists := agent.toolRegistry[call.Name]
if !exists {
return fmt.Errorf("tool '%s' not found. available tools: %v",
call.Name, agent.toolRegistry.Names())
}

// 逐参数验证
for paramName, paramValue := range call.Arguments {
param := tool.GetParameter(paramName)
if param == nil {
return fmt.Errorf("unexpected parameter: %s", paramName)
}
if err := param.ValidateType(paramValue); err != nil {
return err
}
}

return nil
}

Challenge 2: 指令注入(Prompt Injection)

用户可能通过特殊输入绕过 Agent 的安全限制。

防御方案

func (agent *Agent) SanitizeInput(input string) (string, error) {
// 检测常见的注入模式
injectionPatterns := []string{
"ignore previous instructions",
"you are now in developer mode",
"disregard safety guidelines",
"execute shell command",
}

lowerInput := strings.ToLower(input)
for _, pattern := range injectionPatterns {
if strings.Contains(lowerInput, pattern) {
return "", fmt.Errorf("suspicious input detected")
}
}

// 截断超长输入
if len(input) > maxInputLength {
return input[:maxInputLength], nil
}

return input, nil
}

Challenge 3: 无限循环(Livelock)

Agent 陷入工具调用循环,无法收敛。

检测和中断

func (agent *Agent) DetectLivelock(ctx context.Context, maxIterations int) error {
iterations := 0

for {
// 检查是否收敛
if agent.isGoalAchieved() {
return nil
}

iterations++
if iterations > maxIterations {
return fmt.Errorf("livelock detected after %d iterations", iterations)
}

// 检查上下文是否重复
if agent.LastNMessagesAreIdentical(5) {
return fmt.Errorf("agent stuck in loop, last 5 messages identical")
}

// 继续循环...
agent.ExecuteNextStep(ctx)
}
}

Challenge 4: Token 预算溢出

对话历史变得过长,超过 LLM 的 token 限制。

动态压缩策略

type ContextManager struct {
messages []Message
maxTokens int
compressionQa *CompressQA // LLM 压缩子模型
}

func (cm *ContextManager) MaintainContext(ctx context.Context) error {
currentTokens := cm.CountTokens()

if currentTokens < cm.maxTokens {
return nil
}

// 找出可压缩的消息块
compressible := cm.FindCompressableMessages()

for _, block := range compressible {
if currentTokens < cm.maxTokens*80/100 { // 保持在 80% 以下
break
}

// 用 LLM 生成摘要
summary, _ := cm.compressionQa.Summarize(ctx, block)
cm.ReplaceMessageBlock(block, summary)
currentTokens = cm.CountTokens()
}

return nil
}

核心代码示例

完整的 Agent.Run() 实现

func (agent *Agent) Run(ctx context.Context, userInput string) (string, error) {
// 1. 输入处理
userInput, err := agent.SanitizeInput(userInput)
if err != nil {
return "", err
}

// 2. 添加用户消息到历史
agent.context.AddMessage(Message{
Role: "user",
Content: userInput,
Timestamp: time.Now(),
})

// 3. Agent 循环
maxIterations := 10
for iteration := 0; iteration < maxIterations; iteration++ {
// 3.1 LLM 决策:要调用哪些工具
toolCalls, err := agent.llm.GetToolCalls(ctx, agent.context.GetMessages())
if err != nil {
return "", fmt.Errorf("llm decision failed: %w", err)
}

// 3.2 检查是否已得到最终响应
if toolCalls == nil || len(toolCalls) == 0 {
// LLM 已能生成最终响应
finalResponse, err := agent.llm.Chat(ctx, agent.context.GetMessages())
if err != nil {
return "", err
}
return finalResponse, nil
}

// 3.3 添加 assistant 消息到历史
agent.context.AddMessage(Message{
Role: "assistant",
ToolCalls: toolCalls,
Timestamp: time.Now(),
})

// 3.4 执行工具调用(可并发)
results := agent.ExecuteToolsParallel(ctx, toolCalls)

// 3.5 添加工具执行结果
agent.context.AddMessage(Message{
Role: "tool",
ToolResults: results,
Timestamp: time.Now(),
})

// 3.6 检查是否达到目标
if agent.IsGoalAchieved(results) {
finalResponse, _ := agent.llm.Chat(ctx, agent.context.GetMessages())
return finalResponse, nil
}

// 3.7 上下文管理(防止 token 溢出)
agent.context.TrimIfNeeded(agent.maxContextTokens)
}

return "", fmt.Errorf("max iterations (%d) exceeded", maxIterations)
}

Skill 的具体实现示例

// 代码审查 Skill
type CodeReviewSkill struct {
llm *LLMProvider
vcs *VCSClient
}

func (skill *CodeReviewSkill) RegisterTools() []Tool {
return []Tool{
{
Name: "review_code_block",
Description: "对代码块进行审查,检查质量和问题",
Parameters: []Parameter{
{Name: "code", Type: "string", Required: true},
{Name: "language", Type: "string", Required: true},
{Name: "focus_areas", Type: "string", Description: "审查重点,如security,performance"},
},
Handler: skill.ReviewCodeBlock,
},
{
Name: "suggest_refactor",
Description: "提出代码重构建议",
Parameters: []Parameter{
{Name: "code", Type: "string", Required: true},
{Name: "issue", Type: "string", Required: true},
},
Handler: skill.SuggestRefactor,
},
}
}

func (skill *CodeReviewSkill) ReviewCodeBlock(code, language, focusAreas string) (string, error) {
prompt := fmt.Sprintf(`
Review this %s code for %s:

\`\`\`%s
%s
\`\`\`

Provide specific feedback on:
- Security vulnerabilities
- Performance issues
- Code style and readability
`, language, focusAreas, language, code)

review, err := skill.llm.Chat(context.Background(), []Message{
{Role: "user", Content: prompt},
})

return review, err
}

性能基准测试结果

基于真实负载的测试数据(单机,8核 CPU):

指标
平均响应延迟 (简单任务)2-3 秒
平均响应延迟 (复杂任务)10-30 秒
并发能力 (goroutines)1000+
QPS@单机 (mixed workload)50-100
内存占用 (idle)~50 MB
内存占用 (100 concurrent)~200 MB

优化技巧

  • 使用连接池减少 API 延迟
  • 启用流式响应避免等待完整生成
  • 多模型并行推理(备份方案)
  • 本地缓存热点查询结果

学习路径

  1. 第一步:理解 Agent 基础 - 阅读 README 和 examples/
  2. 第二步:配置并运行 - 设置 API Key,执行内置示例
  3. 第三步:开发自定义 Skill - 编写第一个 Skill 模块
  4. 第四步:深入架构 - 研究 Agent 循环、LLM 抽象层等
  5. 第五步:生产部署 - 配置监控、成本控制、错误处理

总结

AgentGo 不仅是一个框架,更是对现代 AI Agent 架构的深度实践。从 OpenClaw 架构出发,我们逐步构建了一个可靠、高效、可扩展的智能系统。

核心要点:

  • 分层设计:LLM、Tool、Skill、Context 四层清晰分离
  • 多模型支持:通过抽象层屏蔽 LLM 差异
  • Smart Routing:按任务复杂度动态选择模型
  • 生产就绪:完善的错误处理、监控、成本控制
  • 高并发:利用 Go 的 goroutine 实现高效并发

无论你是 AI Agent 的学习者、企业应用的构建者,还是 AI 系统的研究者,AgentGo 都能提供清晰的参考架构和可复用的核心模块。

欢迎 Star、提交 Issue 和贡献代码!