Skip to content

go-sdk

go-sdk · AI Agent Assembly

AI agents take real actions — calling APIs, running code, spending money, touching data. This SDK lets a team decide, in advance, which of those actions an agent is allowed to take, and keeps a record of every one. It is the Go on-ramp to that control.

The Go SDK for AI Agent Assembly lets you put a governance checkpoint in front of the tools your AI agent calls — without rewriting the agent. You initialise the runtime once, wrap your tool slice, and from then on every tool call is checked against your gateway’s policy before it runs and recorded after it finishes.

It is written in idiomatic Go: functional options, context-first APIs, typed errors, and a pure-Go default that builds with CGO_ENABLED=0.

What it is

Concretely, the SDK is two things working together:

  • A thin governance client. It opens one connection to the AI Agent Assembly gateway (the policy brain, which lives in the agent-assembly core repo) and speaks its wire protocol over gRPC/HTTP — or, in local development, auto-discovers and starts a gateway for you.
  • An in-process interception shim. WrapTools decorates your existing Tool values so each Call runs a policy Check first and a RecordResult after. Your agent code keeps calling tools the way it always did; the wrapper does the governance.

For the platform as a whole — what the gateway is, how policy and budgets are authored, and how the three interception layers fit together — see the core agent-assembly documentation and the shared docs hub.

Who it’s for

  • Go developers building or operating AI agents who need allow/deny, audit, budget, and topology governance over what their agents can do — and want to add it as a library, not a rewrite.
  • Platform teams standardising agent governance across services: the same gateway and policy back several languages (there are sibling Python and Node SDKs), so a Go service joins the same control plane.

Quick look

package main

import (
    "context"
    "log"

    "github.com/ai-agent-assembly/go-sdk/assembly"
)

func main() {
    ctx := assembly.WithAgentID(context.Background(), "my-agent")

    a, err := assembly.Init(ctx,
        assembly.WithGatewayURL("https://gateway.example.com"),
        assembly.WithAPIKey("..."), // optional for local dev
    )
    if err != nil {
        log.Fatal(err)
    }
    defer a.Close()

    governed := assembly.WrapTools(myTools, nil)
    _ = governed // hand these to your agent in place of the originals
}

Get started in 3 steps →

Documentation map

SectionWhat’s inside
Quick StartInstall, configure, and govern your first agent’s tools — copy-paste.
Core ConceptsHow the SDK talks to the gateway, the client lifecycle, modes, and enforcement.
GuidesTask-first walkthroughs: wrap an agent’s tools, integrate a framework, handle allow/deny and errors.
ConfigurationGateway/API-key resolution, every Init option, enforcement modes, context helpers.
API ReferenceThe authoritative godoc on pkg.go.dev, plus a curated summary of the key exported API.
Compatibility & VersioningGateway protocol pin, the core↔SDK matrix, toolchain floor, and the release process.
TroubleshootingTyped errors, timeouts, build/transport gotchas, and where to get help.

Pure-Go by default (CGO_ENABLED=0); the native FFI transport is opt-in via -tags aa_ffi_go. See Core Concepts.