Go Agent Sdk banner
chenhg5 chenhg5

Go Agent Sdk

Development community

Description

golang agent adk, inspired by claude code

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

go-agent-sdk

A composable Go SDK for building LLM-powered agents. Inspired by the architecture of [Claude Code](https://github.com/anthropics/claude-code), designed for embedding into any Go project.

[**中文文档 / Chinese Documentation**](README_CN.md)

Features

  • Interface-driven — every module (Provider, Tool, Executor) is a swappable interface
  • Streaming — real-time token streaming with event callbacks
  • Tool use — agentic loop that calls tools and feeds results back automatically
  • Zero external deps — standard library only (core SDK)
  • Built-in tools — Bash, FileRead, FileEdit, FileWrite, Glob, Grep out of the box
  • Multi-provider — Claude built-in; OpenAI, Bedrock, Vertex implementable via Provider interface
  • Permission control — sync/async interactive approval; agent loop pauses until user decides
  • MCP support — dynamically discover and call external tools via Model Context Protocol
  • Sub-agents — delegate tasks to child agents and collect results
  • ACP protocol — expose the agent as a standard Agent Client Protocol server (stdio JSON-RPC)

Install

go get github.com/chenhg5/go-agent-sdk

Quick Start

package main

import (
    "context"
    "fmt"
    "os"

    agentsdk "github.com/chenhg5/go-agent-sdk"
    "github.com/chenhg5/go-agent-sdk/claude"
)

func main() {
    agent, err := agentsdk.New(
        agentsdk.WithProvider(claude.NewProvider(os.Getenv("ANTHROPIC_AUTH_TOKEN"))),
        agentsdk.WithSystemPrompt("You are a helpful coding assistant."),
    )
    if err != nil {
        panic(err)
    }

    result, err := agent.Run(context.Background(), "What is a goroutine in Go?")
    if err != nil {
        panic(err)
    }

    fmt.Println(result.Messages[len(result.Messages)-1].TextContent())
}

Streaming

result, err := agent.RunStream(ctx, "Explain Go interfaces.", func(evt agentsdk.Event) {
    switch evt.Type {
    case agentsdk.Ev