# tRPC-Agent-Go

> A Go-native framework for production agent systems: LLM agents, graph workflows, tools, memory, evaluation and tracing in one stack

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: Go
- Licence: Apache-2.0
- Repository: https://github.com/trpc-group/trpc-agent-go
- Website: https://trpc-group.github.io/trpc-agent-go/
- Canonical page: https://ai-tldr.dev/tools/trpc-agent-go/

## In short

tRPC-Agent-Go is an open-source Go framework from the tRPC group for building production agent systems. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in Go and licensed Apache-2.0. To get started: clone the repository.

## Overview

tRPC-Agent-Go is an open-source Go framework from the tRPC group for building production agent systems. Its README describes one Go-native stack that covers LLM agents, graph workflows, tool calling, session and memory state, knowledge retrieval, agent self-evolution, evaluation and OpenTelemetry observability, aimed at agent applications that have to fit into Go services: concurrent, observable and easy to deploy.

The core pieces are a Runner, which orchestrates execution, manages sessions and connects the memory service, and agents that you compose rather than implement. The framework ships an LLMAgent that wraps a chat-completion model, a ChainAgent that runs sub-agents in sequence, a ParallelAgent that runs them concurrently and merges their output, and a CycleAgent that loops until a stop condition. GraphAgent adds type-safe graph workflows with conditional and multi-conditional fan-out routing, which the project describes as functionally equivalent to LangGraph for Go.

Around those agents sit packages for models (OpenAI, DeepSeek and other providers), tools (Go functions turned into tools, MCP tools, DuckDuckGo web search, code execution), sessions, long-term memory with in-memory and Redis backends, RAG knowledge retrieval, a planner, versioned artifacts with in-memory, S3 and COS backends, and reusable Agent Skills defined by SKILL.md folders. An evolution service can review completed sessions in the background and publish reusable procedures back as managed skills after quality gates.

For integration, the server package exposes agents over AG-UI for frontends (with a built-in Server-Sent Events server and CopilotKit and TDesign Chat client samples), A2A for agent-to-agent interoperability, and a gateway server. Runs can be cancelled via context, from code or by request ID; an evaluation package runs repeatable eval sets with pluggable metrics; and OpenTelemetry hooks span the model, tool and runner layers, with Langfuse examples. The README credits Tencent business units including Tencent Yuanbao, Tencent Video and QQ Music with real-world validation. It is written in Go and released under the Apache-2.0 license.

## What it does

- Built-in LLMAgent, ChainAgent, ParallelAgent and CycleAgent that nest into multi-agent pipelines without implementing the agent interface yourself
- GraphAgent: type-safe state graphs with conditional and multi-conditional fan-out routing, run through the same Runner
- Tool ecosystem covering Go function tools, MCP tools via trpc-mcp-go, DuckDuckGo web search and secure code execution
- Session, memory (in-memory and Redis), RAG knowledge retrieval and versioned artifacts (in-memory, S3, COS)
- Agent Skills from SKILL.md folders, plus a self-evolution service that turns reviewed sessions into managed skills
- AG-UI, A2A and gateway servers, eval sets with pluggable metrics, and OpenTelemetry tracing with Langfuse examples

## Getting started

The README's quick start runs a bundled example agent from a clone of the repository. You need Go 1.21 or later and an API key for an LLM provider such as OpenAI or DeepSeek. The runner example opens an interactive, streaming chat with calculator and time tools.

1. Clone the repository

   The examples directory contains runnable demos for every major feature.

```bash
git clone https://github.com/trpc-group/trpc-agent-go.git
cd trpc-agent-go
```

2. Configure your LLM

   Set your provider key; the base URL is optional and lets you point at an OpenAI-compatible endpoint.

```bash
export OPENAI_API_KEY="your-api-key-here"
export OPENAI_BASE_URL="your-base-url-here"  # Optional
```

3. Run your first agent

   Start the runner example with streaming on, then try a prompt such as "What's the current time? Then calculate 15 * 23 + 100" to watch it call its tools across a multi-turn conversation.

```bash
cd examples/runner
go run . -model="gpt-4o-mini" -streaming=true
```

4. Build an agent in your own code

   In your own program, create a model, wrap a Go function as a tool, build an LLMAgent and execute it through a Runner, which returns a stream of events. This is condensed from the README's Basic Usage example, which also defines the calculator function and its request and response types.

```go
modelInstance := openai.New("deepseek-chat",
    openai.WithVariant(openai.VariantDeepSeek),
)

calculatorTool := function.NewFunctionTool(
    calculator,
    function.WithName("calculator"),
    function.WithDescription("Execute addition, subtraction, multiplication, and division."),
)

agent := llmagent.New("assistant",
    llmagent.WithModel(modelInstance),
    llmagent.WithTools([]tool.Tool{calculatorTool}),
    llmagent.WithGenerationConfig(model.GenerationConfig{Stream: true}),
)

runner := runner.NewRunner("calculator-app", agent)
events, err := runner.Run(context.Background(),
    "user-001", "session-001",
    model.NewUserMessage("Calculate what 2+3 equals"),
)
if err != nil {
    log.Fatal(err)
}
for event := range events {
    if event.Object == "chat.completion.chunk" {
        fmt.Print(event.Response.Choices[0].Delta.Content)
    }
}
```

5. Compose agents into a pipeline

   Nest the built-in agents to build workflows: here a ChainAgent passes an assistant's output to a translator agent, and the Runner adds sessions and telemetry.

```go
pipeline := chainagent.New(
    "pipeline",
    chainagent.WithSubAgents([]agent.Agent{base, translator}),
)

run := runner.NewRunner("demo-app", pipeline)
events, _ := run.Run(ctx, "user-1", "sess-1",
    model.NewUserMessage("Hello!"))
for ev := range events { /* ... */ }
```

## When to use it

- Reach for it when your backend is written in Go and you want agents that live inside those services instead of a separate Python runtime
- Use it to build controllable multi-step workflows, such as customer-support or business-process bots with human-in-the-loop, as graphs or chained, parallel and looping agents
- Reach for it when an agent must stream events to a web frontend over AG-UI or interoperate with other agents over A2A
- Use it when you need to measure and trace agent quality in production, with eval sets, OpenTelemetry tracing and Langfuse
