Aviato / docs
Build integrations

Go SDK

Serve an Aviato plugin from a Go application.

View Markdown

The Go SDK lives in the github.com/getaviato/aviato-go module and requires Go 1.25 or newer. Use a published release compatible with your agent; the monorepo implementation is in packages/sdk-go.

Create and mount a plugin

package main

import (
    "context"
    "log"
    "net/http"
    "os"

    aviato "github.com/getaviato/aviato-go"
)

func main() {
    plugin := aviato.MustNew(aviato.Options{
        Secret: os.Getenv("AVIATO_PLUGIN_SECRET"),
        BasePath: "/aviato",
    })
    plugin.Action("customers", "Confirm selection", aviato.ScopeSingle,
        func(ctx context.Context, action *aviato.ActionContext) (aviato.Result, error) {
            if _, err := action.Records(ctx); err != nil {
                return nil, err
            }
            return action.Success("Customer selected", "customers"), nil
        })
    http.Handle("/aviato/", plugin.Handler())
    log.Fatal(http.ListenAndServe(":4100", nil))
}

Configure AVIATO_PLUGIN_URL and AVIATO_PLUGIN_SECRET on the agent, using the same secret as your Go process. Terminate HTTPS in front of your service when it is exposed outside a trusted network.

Framework adapters

The SDK includes Gin and Echo adapters. The Gin fixture demonstrates actions and custom datasources exercised by protocol conformance tests.

Test your handlers

Use the aviatotest harness for local handler tests with a fake caller and seeded Data API. Test both the returned action result and changes made through the Data API. See the SDK README for the harness API.

Edit on GitHub

On this page