Skip to content
AgentField
SDKs

Go SDK

Build production agents in Go with the AgentField SDK

Go SDK — go get agentfield

Build and deploy AI agents in Go with idiomatic patterns.

The Go SDK provides the same core primitives as the Python and TypeScript SDKs -- agents, reasoners, memory, AI, cross-agent calls -- with idiomatic Go patterns: functional options, explicit error returns, and context.Context propagation.

Install

go get github.com/Agent-Field/agentfield/sdk/go
import "github.com/Agent-Field/agentfield/sdk/go/agent"
import "github.com/Agent-Field/agentfield/sdk/go/ai"

Quick Start

package main

import (
    "context"
    "log"

    "github.com/Agent-Field/agentfield/sdk/go/agent"
)

func main() {
    app, err := agent.New(agent.Config{
        NodeID:        "my-agent",
        Version:       "1.0.0",
        AgentFieldURL: "http://localhost:8080",
        ListenAddress: ":8001",
    })
    if err != nil {
        log.Fatal(err)
    }

    app.RegisterReasoner("greet", func(ctx context.Context, input map[string]any) (any, error) {
        name, _ := input["name"].(string)
        return map[string]any{"message": "Hello, " + name}, nil
    })

    if err := app.Serve(context.Background()); err != nil {
        log.Fatal(err)
    }
}

The Go SDK does not have separate skill registration or an AgentRouter. All capabilities are registered as reasoners. For routing across multiple agents, use the control plane's discovery and execution APIs.