{
  "markdown": "<div align=\"center\">\n  <img src=\"docs/mkdocs/assets/img/logo-readme-blue.png\" alt=\"tRPC logo\" width=\"260\">\n\n  <a id=\"trpc-agent-go\"></a>\n  <h1>tRPC-Agent-Go</h1>\n\n  <p>\n    English | <a href=\"README.zh_CN.md\">中文</a>\n  </p>\n\n<p align=\"center\">\n  <a href=\"https://trendshift.io/repositories/15288\"><img src=\"https://trendshift.io/api/badge/repositories/15288\" alt=\"GitHub Trending #3 Repository Of The Day archived by Trendshift\" width=\"250\" height=\"55\"></a>\n  <a href=\"https://trendshift.io/repositories/15288\"><img src=\"https://trendshift.io/api/badge/trendshift/repositories/15288/daily?language=Go\" alt=\"Trendshift #1 Go Repository Of The Day\" width=\"250\" height=\"55\"></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://pkg.go.dev/trpc.group/trpc-go/trpc-agent-go\"><img src=\"https://pkg.go.dev/badge/trpc.group/trpc-go/trpc-agent-go.svg\" alt=\"Go Reference\"></a>\n  <a href=\"https://github.com/trpc-group/trpc-agent-go/blob/main/LICENSE\"><img src=\"https://img.shields.io/badge/license-Apache--2.0-green.svg\" alt=\"LICENSE\"></a>\n  <a href=\"https://github.com/trpc-group/trpc-agent-go/releases\"><img src=\"https://img.shields.io/github/release/trpc-group/trpc-agent-go.svg?style=flat-square\" alt=\"Releases\"></a>\n  <a href=\"https://github.com/trpc-group/trpc-agent-go/actions/workflows/prc.yml\"><img src=\"https://github.com/trpc-group/trpc-agent-go/actions/workflows/prc.yml/badge.svg\" alt=\"Tests\"></a>\n  <a href=\"https://app.codecov.io/gh/trpc-group/trpc-agent-go/tree/main\"><img src=\"https://codecov.io/gh/trpc-group/trpc-agent-go/branch/main/graph/badge.svg\" alt=\"Coverage\"></a>\n  <a href=\"https://trpc-group.github.io/trpc-agent-go/\"><img src=\"https://img.shields.io/badge/Docs-Website-blue.svg\" alt=\"Documentation\"></a>\n</p>\n\n  <hr />\n</div>\n\n**tRPC-Agent-Go is a Go framework for building production agent systems.**\nIt provides LLM agents, graph workflows, tool calling, session and memory\nstate, knowledge retrieval, agent self-evolution, evaluation, and OpenTelemetry\nobservability in one Go-native stack.\n\nUse it when you want agent applications that fit Go services: concurrent,\nobservable, easy to deploy, and ready to integrate with A2A, AG-UI, and MCP.\n\n**Why tRPC-Agent-Go?**\n\n- **Go-Native Agent Runtime**: Streaming runners, context cancellation, and\n  service-friendly APIs\n- **GraphAgent**: Type-safe graph workflows with multi-conditional routing,\n  functionally equivalent to LangGraph for Go\n- **Multi-Agent Collaboration**: Chain, parallel, and cycle-based workflows\n- **Rich Tool Ecosystem**: Function tools, MCP tools, web search, code\n  execution, and custom services\n- **Persistent State**: Session, memory, artifacts, and knowledge retrieval\n- **Agent Skills**: Reusable `SKILL.md` workflows with safe execution\n- **Agent Self-Evolution**: Hermes-style session reviews that extract, gate,\n  and publish reusable `SKILL.md` workflows\n- **Prompt Caching**: Automatic cost optimization with 90% savings on cached content\n- **Evaluation & Benchmarks**: Eval sets + metrics to measure quality over time\n- **Protocol Integration**: AG-UI for frontends, A2A for agent\n  interoperability, and MCP for tools\n- **Production Observability**: OpenTelemetry tracing, metrics, and Langfuse\n  examples\n\n## Use Cases\n\n**Perfect for building:**\n\n- **Customer Support Bots** - Intelligent agents that understand context and solve complex queries\n- **Data Analysis Assistants** - Agents that query databases, generate reports, and provide insights\n- **DevOps Automation** - Smart deployment, monitoring, and incident response systems\n- **Business Process Automation** - Multi-step workflows with human-in-the-loop capabilities\n- **Research & Knowledge Management** - RAG-powered agents for document analysis and Q&A\n\n## Key Features\n\n<table>\n<tr>\n<td width=\"50%\" valign=\"top\">\n\n### Multi-Agent Orchestration\n\n```go\n// Chain agents for complex workflows\npipeline := chainagent.New(\"pipeline\",\n    chainagent.WithSubAgents([]agent.Agent{\n        analyzer, processor, reporter,\n    }))\n\n// Or run them in parallel\nparallel := parallelagent.New(\"concurrent\",\n    parallelagent.WithSubAgents(tasks))\n```\n\n</td>\n<td width=\"50%\" valign=\"top\">\n\n### Advanced Memory System\n\n```go\n// Persistent memory with search\nmemory := memorysvc.NewInMemoryService()\nagent := llmagent.New(\"assistant\",\n    llmagent.WithTools(memory.Tools()),\n    llmagent.WithModel(model))\n\n// Memory service managed at runner level\nrunner := runner.NewRunner(\"app\", agent,\n    runner.WithMemoryService(memory))\n\n// Agents remember context across sessions\n```\n\n</td>\n</tr>\n<tr>\n<td valign=\"top\">\n\n### Rich Tool Integration\n\n```go\n// Any function becomes a tool\ncalculator := function.NewFunctionTool(\n    calculate,\n    function.WithName(\"calculator\"),\n    function.WithDescription(\"Math operations\"))\n\n// MCP protocol support\nmcpTool := mcptool.New(serverConn)\n```\n\n</td>\n<td valign=\"top\">\n\n### Production Observability\n\n```go\n// Start Langfuse integration\nclean, _ := langfuse.Start(ctx)\ndefer clean(ctx)\n\nrunner := runner.NewRunner(\"app\", agent)\n// Run with Langfuse attributes\nevents, _ := runner.Run(ctx, \"user-1\", \"session-1\", \n    model.NewUserMessage(\"Hello\"),\n    agent.WithSpanAttributes(\n        attribute.String(\"langfuse.user.id\", \"user-1\"),\n        attribute.String(\"langfuse.session.id\", \"session-1\"),\n    ))\n```\n\n</td>\n</tr>\n<tr>\n<td valign=\"top\">\n\n### Agent Skills\n\n```go\n// Skills are folders with a SKILL.md spec.\nrepo, _ := skill.NewFSRepository(\"./skills\")\n\n// Let the agent load and run skills on demand.\ntools := []tool.Tool{\n    skilltool.NewLoadTool(repo),\n    skilltool.NewRunTool(repo, localexec.New()),\n}\n```\n\n`NewFSRepository` also accepts an HTTP(S) URL (for example, a `.zip` or\n`.tar.gz` archive). The payload is downloaded and cached locally (set\n`SKILLS_CACHE_DIR` to override the cache location).\n\n`NewFSRepository` also accepts multiple roots, which is useful for\ncombining shared skills with user-private skills. In a long-lived\nprocess, call `repo.Refresh()` after installing, deleting, or renaming a\nskill so the next turn sees the updated skill set.\n\nIf you wire Skills through `LLMAgent` with `llmagent.WithCodeExecutor(...)`,\nconsider also setting\n`llmagent.WithEnableCodeExecutionResponseProcessor(false)` so Markdown fenced\ncode blocks embedded in assistant text do not auto-execute while `skill_run` is\nenabled.\n\n</td>\n<td valign=\"top\">\n\n### Agent Self-Evolution\n\n```go\nrepo, _ := skill.NewFSRepository(\"./managed_skills\")\nevo := evolution.NewService(reviewerModel,\n    evolution.WithManagedSkillsDir(\"./managed_skills\"),\n    evolution.WithSkillRepository(repo))\ndefer evo.Close()\n\nrunner := runner.NewRunner(\"app\", agent,\n    runner.WithEvolutionService(evo))\n```\n\nCompleted sessions can be reviewed asynchronously, promoted through quality\ngates, and published back as managed Agent Skills for future turns.\n\n</td>\n</tr>\n<tr>\n<td colspan=\"2\" valign=\"top\">\n\n### Evaluation & Benchmarks\n\n```go\nevaluator, _ := evaluation.New(\"app\", runner, evaluation.WithNumRuns(3))\ndefer evaluator.Close()\nresult, _ := evaluator.Evaluate(ctx, \"math-basic\")\n_ = result.OverallStatus\n```\n\n</td>\n</tr>\n</table>\n\n## Table of Contents\n\n- [tRPC-Agent-Go](#trpc-agent-go)\n  - [Use Cases](#use-cases)\n  - [Key Features](#key-features)\n    - [Multi-Agent Orchestration](#multi-agent-orchestration)\n    - [Advanced Memory System](#advanced-memory-system)\n    - [Rich Tool Integration](#rich-tool-integration)\n    - [Production Observability](#production-observability)\n    - [Agent Skills](#agent-skills)\n    - [Agent Self-Evolution](#agent-self-evolution)\n    - [Evaluation \\& Benchmarks](#evaluation--benchmarks)\n  - [Table of Contents](#table-of-contents)\n  - [Documentation](#documentation)\n    - [Blog](#blog)\n  - [Quick Start](#quick-start)\n    - [Prerequisites](#prerequisites)\n    - [Run the Example](#run-the-example)\n    - [Basic Usage](#basic-usage)\n    - [Stop / Cancel a Run](#stop--cancel-a-run)\n  - [Examples](#examples)\n    - [1. Tool Usage](#1-tool-usage)\n    - [2. LLM-Only Agent](#2-llm-only-agent)\n    - [3. Multi-Agent Runners](#3-multi-agent-runners)\n    - [4. Graph Agent](#4-graph-agent)\n    - [5. Memory](#5-memory)\n    - [6. Knowledge](#6-knowledge)\n    - [7. Telemetry \\& Tracing](#7-telemetry--tracing)\n    - [8. MCP Integration](#8-mcp-integration)\n    - [9. AG-UI Demo](#9-ag-ui-demo)\n    - [10. Evaluation](#10-evaluation)\n    - [11. Agent Skills](#11-agent-skills)\n    - [12. Agent Self-Evolution](#12-agent-self-evolution)\n    - [13. Artifacts](#13-artifacts)\n    - [14. A2A Interop](#14-a2a-interop)\n    - [15. Gateway Server](#15-gateway-server)\n  - [Architecture Overview](#architecture-overview)\n    - [**Execution Flow**](#execution-flow)\n  - [Using Built-in Agents](#using-built-in-agents)\n    - [Multi-Agent Collaboration Example](#multi-agent-collaboration-example)\n  - [Contributing](#contributing)\n    - [**Ways to Contribute**](#ways-to-contribute)\n    - [**Quick Contribution Setup**](#quick-contribution-setup)\n  - [Acknowledgements](#acknowledgements)\n    - [**Enterprise Validation**](#enterprise-validation)\n    - [**Open Source Inspiration**](#open-source-inspiration)\n  - [Star History](#star-history)\n  - [License](#license)\n    - [**GitHub Repository** • **Report Issues** • **Join Discussions**](#github-repository--report-issues--join-discussions)\n\n## Documentation\n\nReady to dive into tRPC-Agent-Go? Our [documentation](https://trpc-group.github.io/trpc-agent-go/) covers everything from basic concepts to advanced techniques, helping you build powerful AI applications with confidence. Whether you're new to AI agents or an experienced developer, you'll find detailed guides, practical examples, and best practices to accelerate your development journey.\n\n### Blog\n\nThese blog posts cover the framework overview, core capabilities, and engineering practices—read as needed:\n\n- [A Go Agent Framework for Building Intelligent AI Applications](docs/mkdocs/en/blog/trpcagentgo.md)\n- [GraphAgent Seamlessly Combines AI Workflows and Agents](docs/mkdocs/en/blog/graphagent.md)\n- [Quickly Build AG-UI-Based Agent Services](docs/mkdocs/en/blog/agui.md)\n- [A Go-Native Implementation of the Anthropic Agent Skills Specification](docs/mkdocs/en/blog/skill.md)\n- [Building an Enterprise-Grade, Secure, and Controllable OpenClaw Runtime](docs/mkdocs/en/blog/openclaw.md)\n- [A Complete Guide to AI Agent Automated Evaluation Paradigms and Engineering Practice](docs/mkdocs/en/blog/evaluation.md)\n- [A Complete Guide to Automated Prompt Iteration and Engineering Practice for AI Agents](docs/mkdocs/en/blog/promptiter.md)\n\n## Quick Start\n\n![AG-UI report agent demo](docs/mkdocs/assets/gif/agui/report.gif)\n\nThe demo above shows a tRPC-Agent-Go service streaming agent events to an\nAG-UI client while the agent plans, calls tools, and updates the interface.\n\n### Prerequisites\n\n- Go 1.21 or later\n- LLM provider API key (OpenAI, DeepSeek, etc.)\n- 5 minutes to build your first intelligent agent\n\n### Run the Example\n\n**Get started in 3 simple steps:**\n\n```bash\n# 1. Clone and setup\ngit clone https://github.com/trpc-group/trpc-agent-go.git\ncd trpc-agent-go\n\n# 2. Configure your LLM\nexport OPENAI_API_KEY=\"your-api-key-here\"\nexport OPENAI_BASE_URL=\"your-base-url-here\"  # Optional\n\n# 3. Run your first agent!\ncd examples/runner\ngo run . -model=\"gpt-4o-mini\" -streaming=true\n```\n\n**What you'll see:**\n\n- **Interactive chat** with your AI agent\n- **Real-time streaming** responses\n- **Tool usage** (calculator + time tools)\n- **Multi-turn conversations** with memory\n\nTry asking: \"What's the current time? Then calculate 15 \\* 23 + 100\"\n\n### Basic Usage\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"log\"\n\n    \"trpc.group/trpc-go/trpc-agent-go/agent/llmagent\"\n    \"trpc.group/trpc-go/trpc-agent-go/model\"\n    \"trpc.group/trpc-go/trpc-agent-go/model/openai\"\n    \"trpc.group/trpc-go/trpc-agent-go/runner\"\n    \"trpc.group/trpc-go/trpc-agent-go/tool\"\n    \"trpc.group/trpc-go/trpc-agent-go/tool/function\"\n)\n\nfunc main() {\n    // Create model.\n    modelInstance := openai.New(\"deepseek-chat\",\n        openai.WithVariant(openai.VariantDeepSeek),\n    )\n\n    // Create tool.\n    calculatorTool := function.NewFunctionTool(\n        calculator,\n        function.WithName(\"calculator\"),\n        function.WithDescription(\"Execute addition, subtraction, multiplication, and division. \"+\n            \"Parameters: a, b are numeric values, op takes values add/sub/mul/div; \"+\n            \"returns result as the calculation result.\"),\n    )\n\n    // Enable streaming output.\n    genConfig := model.GenerationConfig{\n        Stream: true,\n    }\n\n    // Create Agent.\n    agent := llmagent.New(\"assistant\",\n        llmagent.WithModel(modelInstance),\n        llmagent.WithTools([]tool.Tool{calculatorTool}),\n        llmagent.WithGenerationConfig(genConfig),\n    )\n\n    // Create Runner.\n    runner := runner.NewRunner(\"calculator-app\", agent)\n\n    // Execute conversation.\n    ctx := context.Background()\n    events, err := runner.Run(ctx,\n        \"user-001\",\n        \"session-001\",\n        model.NewUserMessage(\"Calculate what 2+3 equals\"),\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Process event stream.\n    for event := range events {\n        if event.Object == \"chat.completion.chunk\" {\n            fmt.Print(event.Response.Choices[0].Delta.Content)\n        }\n    }\n    fmt.Println()\n}\n\nfunc calculator(ctx context.Context, req calculatorReq) (calculatorRsp, error) {\n    var result float64\n    switch req.Op {\n    case \"add\", \"+\":\n        result = req.A + req.B\n    case \"sub\", \"-\":\n        result = req.A - req.B\n    case \"mul\", \"*\":\n        result = req.A * req.B\n    case \"div\", \"/\":\n        result = req.A / req.B\n\tdefault:\n\t\treturn calculatorRsp{}, fmt.Errorf(\"invalid operation: %s\", req.Op)\n    }\n    return calculatorRsp{Result: result}, nil\n}\n\ntype calculatorReq struct {\n    A  float64 `json:\"A\"  jsonschema:\"description=First integer operand,required\"`\n    B  float64 `json:\"B\"  jsonschema:\"description=Second integer operand,required\"`\n    Op string  `json:\"Op\" jsonschema:\"description=Operation type,enum=add,enum=sub,enum=mul,enum=div,required\"`\n}\n\ntype calculatorRsp struct {\n    Result float64 `json:\"result\"`\n}\n```\n\n### Dynamic Agent per Request\n\nSometimes your Agent must be created **per request** (for example: different\nprompt, model, tools, sandbox instance). In that case, you can let Runner build\na fresh Agent for every `Run(...)`:\n\n```go\nr := runner.NewRunnerWithAgentFactory(\n    \"my-app\",\n    \"assistant\",\n    func(ctx context.Context, ro agent.RunOptions) (agent.Agent, error) {\n        // Use ro to build an Agent for this request.\n        a := llmagent.New(\"assistant\",\n            llmagent.WithInstruction(ro.Instruction),\n        )\n        return a, nil\n    },\n)\n\nevents, err := r.Run(ctx,\n    \"user-001\",\n    \"session-001\",\n    model.NewUserMessage(\"Hello\"),\n    agent.WithInstruction(\"You are a helpful assistant.\"),\n)\n_ = events\n_ = err\n```\n\n### Stop / Cancel a Run\n\nIf you want to interrupt a running agent, **cancel the context** you passed to\n`Runner.Run` (recommended). This stops model calls and tool calls safely and\nlets the runner clean up.\n\nImportant: **do not** just “break” your event loop and walk away — the agent\ngoroutine may keep running and can block on channel writes. Always cancel, then\nkeep draining the event channel until it is closed.\n\n#### Option A: Ctrl+C (terminal programs)\n\nConvert Ctrl+C into context cancellation:\n\n```go\nctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)\ndefer stop()\n\nevents, err := r.Run(ctx, userID, sessionID, message)\nif err != nil {\n    return err\n}\nfor range events {\n    // Drain until the runner stops (ctx canceled or run completed).\n}\n```\n\n#### Option B: Cancel from your code\n\n```go\nctx, cancel := context.WithCancel(context.Background())\ndefer cancel()\n\nevents, err := r.Run(ctx, userID, sessionID, message)\nif err != nil {\n    return err\n}\n\ngo func() {\n    time.Sleep(2 * time.Second)\n    cancel()\n}()\n\nfor range events {\n    // Keep draining until the channel is closed.\n}\n```\n\n#### Option C: Cancel by `requestID` (for servers / background runs)\n\n```go\nrequestID := \"req-123\"\nevents, err := r.Run(ctx, userID, sessionID, message,\n    agent.WithRequestID(requestID),\n)\n\nmr := r.(runner.ManagedRunner)\n_ = mr.Cancel(requestID)\n```\n\nFor more details (including detached cancellation, resume, and server cancel\nroutes), see `docs/mkdocs/en/runner.md` and `docs/mkdocs/en/agui.md`.\n\n## Examples\n\nThe `examples` directory contains runnable demos covering every major feature.\n\nNot sure where to start? Pick a path by what you want to build:\n\n- First multi-turn agent: [examples/runner](examples/runner)\n- Controllable graph workflow: [examples/graph](examples/graph)\n- Agent frontend or streaming UI: [examples/agui](examples/agui)\n- A2A interoperability: [examples/a2aagent](examples/a2aagent)\n- RAG and knowledge retrieval: [examples/knowledge](examples/knowledge)\n- Evaluation and prompt iteration: [examples/evaluation](examples/evaluation)\n- Skills and local automation: [examples/skillrun](examples/skillrun)\n\n### 1. Tool Usage\n\n- [examples/agenttool](examples/agenttool) – Wrap agents as callable tools.\n- [examples/multitools](examples/multitools) – Multiple tools orchestration.\n- [examples/duckduckgo](examples/duckduckgo) – Web search tool integration.\n- [examples/fileinput](examples/fileinput) – Provide files as inputs.\n- [examples/agenttool](examples/agenttool) shows streaming and non-streaming\n  patterns.\n\n### 2. LLM-Only Agent\n\nExample: [examples/llmagent](examples/llmagent)\n\n- Wrap any chat-completion model as an `LLMAgent`.\n- Configure system instructions, temperature, max tokens, etc.\n- Receive incremental `event.Event` updates while the model streams.\n\n### 3. Multi-Agent Runners\n\nExample: [examples/multiagent](examples/multiagent)\n\n- **ChainAgent** – linear pipeline of sub-agents.\n- **ParallelAgent** – run sub-agents concurrently and merge results.\n- **CycleAgent** – iterate until a termination condition is met.\n\n### 4. Graph Agent\n\nExample: [examples/graph](examples/graph)\n\n- **GraphAgent** – demonstrates building and executing complex, conditional\n  workflows using the `graph` and `agent/graph` packages. It shows\n  how to construct a graph-based agent, manage state safely, implement\n  conditional routing, and orchestrate execution with the Runner.\n\n- Multi-conditional fan-out routing:\n\n```go\n// Return multiple branch keys and run targets in parallel.\nsg := graph.NewStateGraph(schema)\nsg.AddNode(\"router\", func(ctx context.Context, s graph.State) (any, error) {\n    return nil, nil\n})\nsg.AddNode(\"A\", func(ctx context.Context, s graph.State) (any, error) {\n    return graph.State{\"a\": 1}, nil\n})\nsg.AddNode(\"B\", func(ctx context.Context, s graph.State) (any, error) {\n    return graph.State{\"b\": 1}, nil\n})\nsg.SetEntryPoint(\"router\")\nsg.AddMultiConditionalEdges(\n    \"router\",\n    func(ctx context.Context, s graph.State) ([]string, error) {\n        return []string{\"goA\", \"goB\"}, nil\n    },\n    map[string]string{\"goA\": \"A\", \"goB\": \"B\"}, // Path map or ends map\n)\nsg.SetFinishPoint(\"A\").SetFinishPoint(\"B\")\n```\n\n### 5. Memory\n\nExample: [examples/memory](examples/memory)\n\n- In‑memory and Redis memory services with CRUD, search and tool integration.\n- How to configure, call tools and customize prompts.\n\n### 6. Knowledge\n\nExample: [examples/knowledge](examples/knowledge)\n\n- Basic RAG example: load sources, embed to a vector store, and search.\n- How to use conversation context and tune loading/concurrency options.\n\n### 7. Telemetry & Tracing\n\nExample: [examples/telemetry](examples/telemetry)\n\n- OpenTelemetry hooks across model, tool and runner layers.\n- Export traces to OTLP endpoint for real-time analysis.\n\n### 8. MCP Integration\n\nExample: [examples/mcptool](examples/mcptool)\n\n- Wrapper utilities around **trpc-mcp-go**, an implementation of the\n  **Model Context Protocol (MCP)**.\n- Provides structured prompts, tool calls, resource and session messages that\n  follow the MCP specification.\n- Enables dynamic tool execution and context-rich interactions between agents\n  and LLMs.\n\n### 9. AG-UI Demo\n\nExample: [examples/agui](examples/agui)\n\n- Exposes a Runner through the AG-UI (Agent-User Interaction) protocol.\n- Built-in Server-Sent Events (SSE) server, plus client samples (for example,\n  CopilotKit and TDesign Chat).\n\n### 10. Evaluation\n\nExample: [examples/evaluation](examples/evaluation)\n\n- Evaluate an agent with repeatable eval sets and pluggable metrics.\n- Includes local file-backed runs and in-memory runs.\n\n### 11. Agent Skills\n\nExamples: [examples/skillrun](examples/skillrun),\n[examples/skillfind](examples/skillfind)\n\n- Skills are folders with a `SKILL.md` spec + optional docs/scripts.\n- Built-in tools: `skill_load`, `skill_list_docs`, `skill_select_docs`,\n  `skill_run`, and (when the executor supports interactive sessions)\n  `skill_exec`, `skill_write_stdin`, `skill_poll_session`,\n  `skill_kill_session`.\n- `skill_run` is the default one-shot command runner in an isolated\n  workspace.\n- `skill_exec` and the session tools cover interactive stdin/TTY flows\n  without inlining full scripts into the prompt. They are registered\n  only when the code executor exposes `InteractiveProgramRunner`\n  (or falls back to a local engine that does).\n- `skill.NewFSRepository(...)` can scan multiple roots, such as a shared\n  skills directory plus a user-private directory. Use\n  `(*skill.FSRepository).Refresh()` after skill installation or removal\n  in long-lived processes.\n- Prefer using `skill_run` only for commands required by the selected skill\n  docs, not for generic shell exploration.\n- When `LLMAgent` uses `WithCodeExecutor(...)` only to support `skill_run`,\n  disable the response code execution processor with\n  `llmagent.WithEnableCodeExecutionResponseProcessor(false)`. The\n  skill-focused examples (`examples/skill`, `examples/skillrun`,\n  `examples/skilldynamicschema`, and\n  `examples/structuredoutputskills`) follow this pattern so fenced code\n  blocks embedded in assistant text do not auto-execute.\n- `examples/skillfind` demonstrates a real end-to-end discovery flow:\n  the model uses a built-in `skill-find` skill to search the public web,\n  install a public GitHub skill into a user-private directory, refresh\n  the repository, and use the new skill in the same conversation.\n  Local execution stays off by default and can be enabled explicitly\n  when you want to run an installed skill.\n\n### 12. Agent Self-Evolution\n\nExample: [examples/evolution](examples/evolution)\n\n- Reviews completed sessions in the background and extracts reusable\n  `SKILL.md` workflows.\n- Supports revision storage, quality gates, human approval, and warm-start\n  behavior when skills are available on later runs.\n- Runner integration is a single option: `runner.WithEvolutionService(...)`.\n\n### 13. Artifacts\n\nExample: [examples/artifact](examples/artifact)\n\n- Save and retrieve versioned files (images, text, reports) produced by tools.\n- Supports multiple backends (in-memory, S3, COS).\n\n### 14. A2A Interop\n\nExample: [examples/a2aadk](examples/a2aadk)\n\n- Agent-to-Agent (A2A) interop with an ADK Python A2A server.\n- Demonstrates streaming, tool calls, and code execution across runtimes.\n\n### 15. Gateway Server\n\nExample: [openclaw](openclaw)\n\n- A minimal OpenClaw-like gateway server.\n- Stable session ids and per-session serialization.\n- Basic safety controls: allowlist + mention gating.\n- OpenClaw-like implementation (Telegram + gateway): [openclaw](openclaw)\n\nOther notable examples:\n\n- [examples/humaninloop](examples/humaninloop) – Human in the loop.\n- [examples/codeexecution](examples/codeexecution) – Secure code execution.\n\nSee individual `README.md` files in each example folder for usage details.\n\n## Architecture Overview\n\nArchitecture\n\n![architecture](docs/mkdocs/assets/img/component_architecture.svg)\n\n### **Execution Flow**\n\n1. **Runner** orchestrates the entire execution pipeline with session management\n2. **Agent** processes requests using multiple specialized components\n3. **Planner** determines the optimal strategy and tool selection\n4. **Tools** execute specific tasks (API calls, calculations, web searches)\n5. **Memory** maintains context and learns from interactions\n6. **Knowledge** provides RAG capabilities for document understanding\n7. **Evolution** reviews completed sessions and turns reusable procedures into\n   managed skills\n\nKey packages:\n\n| Package     | Responsibility                                                                                              |\n| ----------- | ----------------------------------------------------------------------------------------------------------- |\n| `agent`     | Core execution unit, responsible for processing user input and generating responses.                        |\n| `runner`    | Agent executor, responsible for managing execution flow and connecting Session/Memory Service capabilities. |\n| `model`     | Supports multiple LLM models (OpenAI, DeepSeek, etc.).                                                      |\n| `tool`      | Provides various tool capabilities (Function, MCP, DuckDuckGo, etc.).                                       |\n| `session`   | Manages user session state and events.                                                                      |\n| `memory`    | Records user long-term memory and personalized information.                                                 |\n| `knowledge` | Implements RAG knowledge retrieval capabilities.                                                            |\n| `planner`   | Provides Agent planning and reasoning capabilities.                                                         |\n| `artifact`  | Stores and retrieves versioned files produced by agents and tools (images, reports, etc.).                  |\n| `skill`     | Loads and executes reusable Agent Skills defined by `SKILL.md`.                                             |\n| `evolution` | Reviews completed sessions and publishes reusable procedures as managed Agent Skills.                       |\n| `event`     | Defines event types and streaming payloads used across Runner and servers.                                  |\n| `evaluation` | Evaluates agents on eval sets using pluggable metrics and stores results.                                  |\n| `server`    | Exposes HTTP servers (Gateway, AG-UI, A2A) for integration and UIs.                                         |\n| `telemetry` | OpenTelemetry tracing and metrics instrumentation.                                                          |\n\n\n## Using Built-in Agents\n\nFor most applications you **do not** need to implement the `agent.Agent`\ninterface yourself. The framework already ships with several ready-to-use\nagents that you can compose like Lego bricks:\n\n| Agent           | Purpose                                             |\n| --------------- | --------------------------------------------------- |\n| `LLMAgent`      | Wraps an LLM chat-completion model as an agent.     |\n| `ChainAgent`    | Executes sub-agents sequentially.                   |\n| `ParallelAgent` | Executes sub-agents concurrently and merges output. |\n| `CycleAgent`    | Loops over a planner + executor until stop signal.  |\n\n### Multi-Agent Collaboration Example\n\n```go\n// 1. Create a base LLM agent.\nbase := llmagent.New(\n    \"assistant\",\n    llmagent.WithModel(openai.New(\"gpt-4o-mini\")),\n)\n\n// 2. Create a second LLM agent with a different instruction.\ntranslator := llmagent.New(\n    \"translator\",\n    llmagent.WithInstruction(\"Translate everything to French\"),\n    llmagent.WithModel(openai.New(\"gpt-3.5-turbo\")),\n)\n\n// 3. Combine them in a chain.\npipeline := chainagent.New(\n    \"pipeline\",\n    chainagent.WithSubAgents([]agent.Agent{base, translator}),\n)\n\n// 4. Run through the runner for sessions & telemetry.\nrun := runner.NewRunner(\"demo-app\", pipeline)\nevents, _ := run.Run(ctx, \"user-1\", \"sess-1\",\n    model.NewUserMessage(\"Hello!\"))\nfor ev := range events { /* ... */ }\n```\n\nThe composition API lets you nest chains, cycles, or parallels to build complex\nworkflows without low-level plumbing.\n\n## Contributing\n\nWe love contributions! Join our growing community of developers building the future of AI agents.\n\n### **Ways to Contribute**\n\n- **Report bugs** or suggest features via [Issues](https://github.com/trpc-group/trpc-agent-go/issues)\n- **Improve documentation** - help others learn faster\n- **Submit PRs** - bug fixes, new features, or examples\n- **Share your use cases** - inspire others with your agent applications\n\n### **Quick Contribution Setup**\n\n```bash\n# Fork & clone the repo\ngit clone https://github.com/YOUR_USERNAME/trpc-agent-go.git\ncd trpc-agent-go\n\n# Run tests to ensure everything works\ngo test ./...\ngo vet ./...\n\n# Make your changes and submit a PR!\n```\n\n**Please read** [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines and coding standards.\n\n## Acknowledgements\n\n### **Enterprise Validation**\n\nSpecial thanks to Tencent's business units including **Tencent Yuanbao**, **Tencent Video**, **Tencent News**, **IMA**, and **QQ Music** for their invaluable support and real-world validation. Production usage drives framework excellence!\n\n### **Open Source Inspiration**\n\nInspired by amazing frameworks like **ADK**, **Agno**, **CrewAI**, **AutoGen**, and many others. Standing on the shoulders of giants!\n\n---\n\n## Star History\n\n[![Star History Chart](https://raw.githubusercontent.com/trpc-group/trpc-agent-go/star-history/star-history.svg)](https://github.com/trpc-group/trpc-agent-go/tree/star-history)\n\n---\n\n## License\n\nLicensed under the **Apache 2.0 License** - see [LICENSE](LICENSE) file for details.\n\n---\n\n<div align=\"center\">\n\n### **GitHub Repository** • **Report Issues** • **Join Discussions**\n\nIf tRPC-Agent-Go is useful for your Go agent projects, stars are welcome.\n\n_Empowering developers to build the next generation of intelligent applications_\n\n</div>\n",
  "bytes": 29904,
  "sha": "9fdf5f1f155e0535d7b488956c0c71ae8c87c9ec20bc375c5bb98a03331c284d",
  "repo_slug": "trpc-group/trpc-agent-go",
  "fonte": "repo",
  "truncated": false,
  "api": "https://api.agentalog.com/api/listings/skl_trpc_group_trpc_agent_go_recommend_poi_211f76f8/readme"
}