Skip to content

Go SDK

The Go SDK provides tools for creating, signing, and verifying Agent Receipts in Go applications. It lives in the monorepo at sdk/go/ and is organized into three packages.

  • Create and sign Agent Receipts with Ed25519
  • Build and verify hash-chained receipt sequences
  • Action taxonomy with built-in classification and risk levels
  • SQLite-backed receipt store (pure Go, no CGO required)
  • W3C Verifiable Credentials compliant
PackageImportDescription
receiptgithub.com/agent-receipts/ar/sdk/go/receiptCore receipt creation, signing, verification, and chaining
taxonomygithub.com/agent-receipts/ar/sdk/go/taxonomyAction type registry and tool call classification
storegithub.com/agent-receipts/ar/sdk/go/storeSQLite-backed persistence and querying
package main
import (
"fmt"
"log"
receipt "github.com/agent-receipts/ar/sdk/go/receipt"
)
func main() {
keys, err := receipt.GenerateKeyPair()
if err != nil {
log.Fatal(err)
}
unsigned := receipt.Create(receipt.CreateInput{
Issuer: receipt.Issuer{ID: "did:agent:my-agent"},
Principal: receipt.Principal{ID: "did:user:alice"},
Action: receipt.Action{
Type: "filesystem.file.read",
RiskLevel: receipt.RiskLow,
},
Outcome: receipt.Outcome{Status: receipt.StatusSuccess},
Chain: receipt.Chain{Sequence: 1, ChainID: "chain-1"},
})
signed, err := receipt.Sign(unsigned, keys.PrivateKey, "did:agent:my-agent#key-1")
if err != nil {
log.Fatal(err)
}
valid, err := receipt.Verify(signed, keys.PublicKey)
if err != nil {
log.Fatal(err)
}
fmt.Println("Valid:", valid) // Valid: true
}

See Installation to get started.