[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-84330":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":16,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":20,"createdAt":9,"pushedAt":9,"updatedAt":39,"readmeContent":40,"aiSummary":9,"trendingCount":16,"starSnapshotCount":16,"syncStatus":41,"lastSyncTime":42,"discoverSource":43},84330,"trpc-agent-go","trpc-group\u002Ftrpc-agent-go","trpc-group","A Go framework for building production agent systems with graph workflows, tools, memory, A2A, AG-UI, MCP, evaluation, and observability.",null,"https:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go","Go",1317,159,18,22,0,51.61,false,"main",[21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"a2a","agent","ai","llm","mcp","a2a-protocol","ag-ui","agent-framework","ai-agents","evaluation","go","golang","graph-workflows","model-context-protocol","multi-agent","observability","opentelemetry","rag","2026-06-12 04:01:43","English | [中文](README.zh_CN.md)\n\n# tRPC-Agent-Go\n\n[![Go Reference](https:\u002F\u002Fpkg.go.dev\u002Fbadge\u002Ftrpc.group\u002Ftrpc-go\u002Ftrpc-agent-go.svg)](https:\u002F\u002Fpkg.go.dev\u002Ftrpc.group\u002Ftrpc-go\u002Ftrpc-agent-go)\n[![Go Report Card](https:\u002F\u002Fgoreportcard.com\u002Fbadge\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go)](https:\u002F\u002Fgoreportcard.com\u002Freport\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go)\n[![LICENSE](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache--2.0-green.svg)](https:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go\u002Fblob\u002Fmain\u002FLICENSE)\n[![Releases](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Ftrpc-group\u002Ftrpc-agent-go.svg?style=flat-square)](https:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go\u002Freleases)\n[![Tests](https:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go\u002Factions\u002Fworkflows\u002Fprc.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go\u002Factions\u002Fworkflows\u002Fprc.yml)\n[![Coverage](https:\u002F\u002Fcodecov.io\u002Fgh\u002Ftrpc-group\u002Ftrpc-agent-go\u002Fbranch\u002Fmain\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fapp.codecov.io\u002Fgh\u002Ftrpc-group\u002Ftrpc-agent-go\u002Ftree\u002Fmain)\n[![Documentation](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocs-Website-blue.svg)](https:\u002F\u002Ftrpc-group.github.io\u002Ftrpc-agent-go\u002F)\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, evaluation, and OpenTelemetry observability in one\nGo-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- **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\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"50%\" valign=\"top\">\n\n### Multi-Agent Orchestration\n\n```go\n\u002F\u002F Chain agents for complex workflows\npipeline := chainagent.New(\"pipeline\",\n    chainagent.WithSubAgents([]agent.Agent{\n        analyzer, processor, reporter,\n    }))\n\n\u002F\u002F Or run them in parallel\nparallel := parallelagent.New(\"concurrent\",\n    parallelagent.WithSubAgents(tasks))\n```\n\n\u003C\u002Ftd>\n\u003Ctd width=\"50%\" valign=\"top\">\n\n### Advanced Memory System\n\n```go\n\u002F\u002F Persistent memory with search\nmemory := memorysvc.NewInMemoryService()\nagent := llmagent.New(\"assistant\",\n    llmagent.WithTools(memory.Tools()),\n    llmagent.WithModel(model))\n\n\u002F\u002F Memory service managed at runner level\nrunner := runner.NewRunner(\"app\", agent,\n    runner.WithMemoryService(memory))\n\n\u002F\u002F Agents remember context across sessions\n```\n\n\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd valign=\"top\">\n\n### Rich Tool Integration\n\n```go\n\u002F\u002F Any function becomes a tool\ncalculator := function.NewFunctionTool(\n    calculate,\n    function.WithName(\"calculator\"),\n    function.WithDescription(\"Math operations\"))\n\n\u002F\u002F MCP protocol support\nmcpTool := mcptool.New(serverConn)\n```\n\n\u003C\u002Ftd>\n\u003Ctd valign=\"top\">\n\n### Production Observability\n\n```go\n\u002F\u002F Start Langfuse integration\nclean, _ := langfuse.Start(ctx)\ndefer clean(ctx)\n\nrunner := runner.NewRunner(\"app\", agent)\n\u002F\u002F 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\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd valign=\"top\">\n\n### Agent Skills\n\n```go\n\u002F\u002F Skills are folders with a SKILL.md spec.\nrepo, _ := skill.NewFSRepository(\".\u002Fskills\")\n\n\u002F\u002F 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\u003C\u002Ftd>\n\u003Ctd 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\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\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    - [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 \u002F 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. Artifacts](#12-artifacts)\n    - [13. A2A Interop](#13-a2a-interop)\n    - [14. Gateway Server](#14-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:\u002F\u002Ftrpc-group.github.io\u002Ftrpc-agent-go\u002F) 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\u002Fmkdocs\u002Fen\u002Fblog\u002Ftrpcagentgo.md)\n- [GraphAgent Seamlessly Combines AI Workflows and Agents](docs\u002Fmkdocs\u002Fen\u002Fblog\u002Fgraphagent.md)\n- [Quickly Build AG-UI-Based Agent Services](docs\u002Fmkdocs\u002Fen\u002Fblog\u002Fagui.md)\n- [A Go-Native Implementation of the Anthropic Agent Skills Specification](docs\u002Fmkdocs\u002Fen\u002Fblog\u002Fskill.md)\n- [Building an Enterprise-Grade, Secure, and Controllable OpenClaw Runtime](docs\u002Fmkdocs\u002Fen\u002Fblog\u002Fopenclaw.md)\n- [A Complete Guide to AI Agent Automated Evaluation Paradigms and Engineering Practice](docs\u002Fmkdocs\u002Fen\u002Fblog\u002Fevaluation.md)\n- [A Complete Guide to Automated Prompt Iteration and Engineering Practice for AI Agents](docs\u002Fmkdocs\u002Fen\u002Fblog\u002Fpromptiter.md)\n\n## Quick Start\n\n![AG-UI report agent demo](docs\u002Fmkdocs\u002Fassets\u002Fgif\u002Fagui\u002Freport.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:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-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\u002Frunner\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\u002Ftrpc-go\u002Ftrpc-agent-go\u002Fagent\u002Fllmagent\"\n    \"trpc.group\u002Ftrpc-go\u002Ftrpc-agent-go\u002Fmodel\"\n    \"trpc.group\u002Ftrpc-go\u002Ftrpc-agent-go\u002Fmodel\u002Fopenai\"\n    \"trpc.group\u002Ftrpc-go\u002Ftrpc-agent-go\u002Frunner\"\n    \"trpc.group\u002Ftrpc-go\u002Ftrpc-agent-go\u002Ftool\"\n    \"trpc.group\u002Ftrpc-go\u002Ftrpc-agent-go\u002Ftool\u002Ffunction\"\n)\n\nfunc main() {\n    \u002F\u002F Create model.\n    modelInstance := openai.New(\"deepseek-chat\",\n        openai.WithVariant(openai.VariantDeepSeek),\n    )\n\n    \u002F\u002F 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\u002Fsub\u002Fmul\u002Fdiv; \"+\n            \"returns result as the calculation result.\"),\n    )\n\n    \u002F\u002F Enable streaming output.\n    genConfig := model.GenerationConfig{\n        Stream: true,\n    }\n\n    \u002F\u002F Create Agent.\n    agent := llmagent.New(\"assistant\",\n        llmagent.WithModel(modelInstance),\n        llmagent.WithTools([]tool.Tool{calculatorTool}),\n        llmagent.WithGenerationConfig(genConfig),\n    )\n\n    \u002F\u002F Create Runner.\n    runner := runner.NewRunner(\"calculator-app\", agent)\n\n    \u002F\u002F 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    \u002F\u002F 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\", \"\u002F\":\n        result = req.A \u002F 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        \u002F\u002F 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 \u002F 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    \u002F\u002F 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    \u002F\u002F Keep draining until the channel is closed.\n}\n```\n\n#### Option C: Cancel by `requestID` (for servers \u002F 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\u002Fmkdocs\u002Fen\u002Frunner.md` and `docs\u002Fmkdocs\u002Fen\u002Fagui.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\u002Frunner](examples\u002Frunner)\n- Controllable graph workflow: [examples\u002Fgraph](examples\u002Fgraph)\n- Agent frontend or streaming UI: [examples\u002Fagui](examples\u002Fagui)\n- A2A interoperability: [examples\u002Fa2aagent](examples\u002Fa2aagent)\n- RAG and knowledge retrieval: [examples\u002Fknowledge](examples\u002Fknowledge)\n- Evaluation and prompt iteration: [examples\u002Fevaluation](examples\u002Fevaluation)\n- Skills and local automation: [examples\u002Fskillrun](examples\u002Fskillrun)\n\n### 1. Tool Usage\n\n- [examples\u002Fagenttool](examples\u002Fagenttool) – Wrap agents as callable tools.\n- [examples\u002Fmultitools](examples\u002Fmultitools) – Multiple tools orchestration.\n- [examples\u002Fduckduckgo](examples\u002Fduckduckgo) – Web search tool integration.\n- [examples\u002Ffiletoolset](examples\u002Ffiletoolset) – File operations as tools.\n- [examples\u002Ffileinput](examples\u002Ffileinput) – Provide files as inputs.\n- [examples\u002Fagenttool](examples\u002Fagenttool) shows streaming and non-streaming\n  patterns.\n\n### 2. LLM-Only Agent\n\nExample: [examples\u002Fllmagent](examples\u002Fllmagent)\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\u002Fmultiagent](examples\u002Fmultiagent)\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\u002Fgraph](examples\u002Fgraph)\n\n- **GraphAgent** – demonstrates building and executing complex, conditional\n  workflows using the `graph` and `agent\u002Fgraph` 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\u002F\u002F 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\"}, \u002F\u002F Path map or ends map\n)\nsg.SetFinishPoint(\"A\").SetFinishPoint(\"B\")\n```\n\n### 5. Memory\n\nExample: [examples\u002Fmemory](examples\u002Fmemory)\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\u002Fknowledge](examples\u002Fknowledge)\n\n- Basic RAG example: load sources, embed to a vector store, and search.\n- How to use conversation context and tune loading\u002Fconcurrency options.\n\n### 7. Telemetry & Tracing\n\nExample: [examples\u002Ftelemetry](examples\u002Ftelemetry)\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\u002Fmcptool](examples\u002Fmcptool)\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\u002Fagui](examples\u002Fagui)\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\u002Fevaluation](examples\u002Fevaluation)\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\u002Fskillrun](examples\u002Fskillrun),\n[examples\u002Fskillfind](examples\u002Fskillfind)\n\n- Skills are folders with a `SKILL.md` spec + optional docs\u002Fscripts.\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\u002FTTY 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\u002Fskill`, `examples\u002Fskillrun`,\n  `examples\u002Fskilldynamicschema`, and\n  `examples\u002Fstructuredoutputskills`) follow this pattern so fenced code\n  blocks embedded in assistant text do not auto-execute.\n- `examples\u002Fskillfind` 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. Artifacts\n\nExample: [examples\u002Fartifact](examples\u002Fartifact)\n\n- Save and retrieve versioned files (images, text, reports) produced by tools.\n- Supports multiple backends (in-memory, S3, COS).\n\n### 13. A2A Interop\n\nExample: [examples\u002Fa2aadk](examples\u002Fa2aadk)\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### 14. 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\u002Fhumaninloop](examples\u002Fhumaninloop) – Human in the loop.\n- [examples\u002Fcodeexecution](examples\u002Fcodeexecution) – 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\u002Fmkdocs\u002Fassets\u002Fimg\u002Fcomponent_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\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\u002FMemory 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| `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\u002F\u002F 1. Create a base LLM agent.\nbase := llmagent.New(\n    \"assistant\",\n    llmagent.WithModel(openai.New(\"gpt-4o-mini\")),\n)\n\n\u002F\u002F 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\u002F\u002F 3. Combine them in a chain.\npipeline := chainagent.New(\n    \"pipeline\",\n    chainagent.WithSubAgents([]agent.Agent{base, translator}),\n)\n\n\u002F\u002F 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 { \u002F* ... *\u002F }\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:\u002F\u002Fgithub.com\u002Ftrpc-group\u002Ftrpc-agent-go\u002Fissues)\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:\u002F\u002Fgithub.com\u002FYOUR_USERNAME\u002Ftrpc-agent-go.git\ncd trpc-agent-go\n\n# Run tests to ensure everything works\ngo test .\u002F...\ngo vet .\u002F...\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:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=trpc-group\u002Ftrpc-agent-go&type=Date)](https:\u002F\u002Fstar-history.com\u002F#trpc-group\u002Ftrpc-agent-go&Date)\n\n---\n\n## License\n\nLicensed under the **Apache 2.0 License** - see [LICENSE](LICENSE) file for details.\n\n---\n\n\u003Cdiv 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\u003C\u002Fdiv>\n",2,"2026-06-11 04:12:48","trending"]