Go SDK

The Go SDK is the primary client for building agents on the Athyr platform. It provides production-ready features including orchestration patterns, middleware, and resilience out of the box.

Installation

go get github.com/athyr-tech/athyr-sdk-go

Requires Go 1.21+ and a running Athyr server.

Quick Start

package main

import (
    "context"
    "github.com/athyr-tech/athyr-sdk-go/pkg/athyr"
)

func main() {
    agent := athyr.MustConnect("localhost:9090",
        athyr.WithAgentCard(athyr.AgentCard{
            Name:        "my-agent",
            Description: "My first Athyr agent",
        }),
    )
    defer agent.Close()

    resp, _ := agent.Complete(context.Background(), athyr.CompletionRequest{
        Model:    "llama3",
        Messages: []athyr.Message{{Role: "user", Content: "Hello!"}},
    })
    println(resp.Content)
}

Features

Core Agent

Orchestration Patterns

Located in pkg/orchestration/:

PatternDescription
PipelineSequential agent chain (A → B → C)
FanOutParallel execution with aggregation
HandoffDynamic routing via triage agent
GroupChatMulti-agent collaborative discussion

Middleware

Server Pattern

For building agent services that handle requests:

server := athyr.NewServer("localhost:9090",
    athyr.WithAgentName("my-service"),
)

athyr.Handle(server, "echo.request", func(ctx athyr.Context, req EchoRequest) (EchoResponse, error) {
    return EchoResponse{Echo: req.Message}, nil
})

server.Run(context.Background())

Documentation

Full documentation and examples are maintained in the SDK repository:

Available Examples

ExampleDemonstrates
quickstartBasic agent setup
pipelineSequential orchestration
fanoutParallel execution
group-chatMulti-agent collaboration
handoff-routerDynamic routing via triage
resilienceError handling and retries
tool-callingLLM function calling

Next Steps