{"id":35093989,"url":"https://github.com/trpc-group/trpc-agent-go","last_synced_at":"2026-03-17T09:08:09.484Z","repository":{"id":308696732,"uuid":"983515771","full_name":"trpc-group/trpc-agent-go","owner":"trpc-group","description":"trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.","archived":false,"fork":false,"pushed_at":"2025-12-17T08:27:35.000Z","size":26155,"stargazers_count":760,"open_issues_count":31,"forks_count":66,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-12-17T20:56:33.765Z","etag":null,"topics":["a2a","agent","ai","llm","mcp"],"latest_commit_sha":null,"homepage":"https://trpc-group.github.io/trpc-agent-go/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trpc-group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-14T13:51:35.000Z","updated_at":"2025-12-17T10:03:08.000Z","dependencies_parsed_at":"2025-08-07T11:35:14.440Z","dependency_job_id":"965224e5-4006-4aff-90a2-04031ddb4a66","html_url":"https://github.com/trpc-group/trpc-agent-go","commit_stats":null,"previous_names":["trpc-group/trpc-agent-go"],"tags_count":241,"template":false,"template_full_name":null,"purl":"pkg:github/trpc-group/trpc-agent-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-group%2Ftrpc-agent-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-group%2Ftrpc-agent-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-group%2Ftrpc-agent-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-group%2Ftrpc-agent-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trpc-group","download_url":"https://codeload.github.com/trpc-group/trpc-agent-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-group%2Ftrpc-agent-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28017722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a2a","agent","ai","llm","mcp"],"created_at":"2025-12-27T15:04:24.309Z","updated_at":"2026-03-17T09:08:09.477Z","avatar_url":"https://github.com/trpc-group.png","language":"Go","funding_links":[],"categories":["Artificial Intelligence","📚 Projects (1974 total)","⚙️ Implementations \u0026 Libraries","AI Models \u0026 Inference","Catalog","Frameworks","Swarm Frameworks"],"sub_categories":["MCP Servers","Harness Architecture \u0026 Orchestration"],"readme":"English | [中文](README.zh_CN.md)\n\n# tRPC-Agent-Go\n\n[![Go Reference](https://pkg.go.dev/badge/trpc.group/trpc-go/trpc-agent-go.svg)](https://pkg.go.dev/trpc.group/trpc-go/trpc-agent-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/trpc-group/trpc-agent-go)](https://goreportcard.com/report/github.com/trpc-group/trpc-agent-go)\n[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-green.svg)](https://github.com/trpc-group/trpc-agent-go/blob/main/LICENSE)\n[![Releases](https://img.shields.io/github/release/trpc-group/trpc-agent-go.svg?style=flat-square)](https://github.com/trpc-group/trpc-agent-go/releases)\n[![Tests](https://github.com/trpc-group/trpc-agent-go/actions/workflows/prc.yml/badge.svg)](https://github.com/trpc-group/trpc-agent-go/actions/workflows/prc.yml)\n[![Coverage](https://codecov.io/gh/trpc-group/trpc-agent-go/branch/main/graph/badge.svg)](https://app.codecov.io/gh/trpc-group/trpc-agent-go/tree/main)\n[![Documentation](https://img.shields.io/badge/Docs-Website-blue.svg)](https://trpc-group.github.io/trpc-agent-go/)\n\n**A powerful Go framework for building intelligent agent systems** that transforms how you create AI applications. Build autonomous agents that think, remember, collaborate, and act with unprecedented ease.\n\n**Why tRPC-Agent-Go?**\n\n- **Intelligent Reasoning**: Advanced hierarchical planners and multi-agent orchestration\n- **Rich Tool Ecosystem**: Seamless integration with external APIs, databases, and services\n- **Persistent Memory**: Long-term state management and contextual awareness\n- **Multi-Agent Collaboration**: Chain, parallel, and graph-based agent workflows\n- **GraphAgent**: Type-safe graph workflows with multi-conditional routing, functionally equivalent to LangGraph for Go\n- **Agent Skills**: Reusable `SKILL.md` workflows with safe execution\n- **Artifacts**: Versioned storage for files produced by agents and tools\n- **Prompt Caching**: Automatic cost optimization with 90% savings on cached content\n- **Evaluation \u0026 Benchmarks**: Eval sets + metrics to measure quality over time\n- **UI \u0026 Server Integration**: AG-UI (Agent-User Interaction),\n  and Agent-to-Agent (A2A) interoperability\n- **Production Ready**: Built-in telemetry, tracing, and enterprise-grade reliability\n- **High Performance**: Optimized for scalability and low latency\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 \u0026 Knowledge Management** - RAG-powered agents for document analysis and Q\u0026A\n\n## Key Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\" valign=\"top\"\u003e\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\u003c/td\u003e\n\u003ctd width=\"50%\" valign=\"top\"\u003e\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\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd valign=\"top\"\u003e\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\u003c/td\u003e\n\u003ctd valign=\"top\"\u003e\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\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd valign=\"top\"\u003e\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\nIf you wire Skills through `LLMAgent` with `llmagent.WithCodeExecutor(...)`,\nconsider also setting\n`llmagent.WithEnableCodeExecutionResponseProcessor(false)` so Markdown fenced\ncode blocks in assistant text do not auto-execute while `skill_run` is\nenabled.\n\n\u003c/td\u003e\n\u003ctd valign=\"top\"\u003e\n\n### Evaluation \u0026 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/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\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 \\\u0026 Benchmarks](#evaluation--benchmarks)\n  - [Table of Contents](#table-of-contents)\n  - [Documentation](#documentation)\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 \\\u0026 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    - [**Star us on GitHub** • **Report Issues** • **Join Discussions**](#star-us-on-github--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## Quick Start\n\n\u003e **See it in Action**: _[Demo GIF placeholder - showing agent reasoning and tool usage]_\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\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\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/filetoolset](examples/filetoolset) – File operations as tools.\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 \u0026 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\nExample: [examples/skillrun](examples/skillrun)\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- 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 in assistant text do not auto-execute.\n\n### 12. 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### 13. 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### 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/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\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| `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 \u0026 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 \u0026 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://api.star-history.com/svg?repos=trpc-group/trpc-agent-go\u0026type=Date)](https://star-history.com/#trpc-group/trpc-agent-go\u0026Date)\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\"\u003e\n\n### **Star us on GitHub** • **Report Issues** • **Join Discussions**\n\n**Built with love by the tRPC-Agent-Go team**\n\n_Empowering developers to build the next generation of intelligent applications_\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrpc-group%2Ftrpc-agent-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrpc-group%2Ftrpc-agent-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrpc-group%2Ftrpc-agent-go/lists"}