AGNT5 Go SDK
Build durable functions, workflows, and AI agents in Go with the agnt5 package
The Go SDK (github.com/agnt5dev/sdk-go/agnt5) lets you define functions, workflows, agents, and tools as typed Go handlers, and run them on a worker that connects to AGNT5. Every step a workflow checkpoints survives worker restarts, and every run is traced.
Installation
go get github.com/agnt5dev/sdk-go@latestThese pages describe version v0.10.7.
Quick example
A function does one unit of work, a workflow runs work as checkpointed steps, and a worker registers both with AGNT5. Each component is registered explicitly:
package main
import (
"context"
"log"
"github.com/agnt5dev/sdk-go/agnt5"
)
type GreetInput struct {
Name string `json:"name"`
}
func greet(ctx *agnt5.Context, in GreetInput) (string, error) {
return "Hello, " + in.Name + "!", nil
}
func welcome(ctx *agnt5.Context, in GreetInput) (map[string]string, error) {
message, err := agnt5.Task(ctx, "greet", in, greet)
if err != nil {
return nil, err
}
return map[string]string{"message": message}, nil
}
func main() {
worker := agnt5.NewWorker("quickstart", agnt5.WithServiceVersion("0.1.0"))
if err := agnt5.RegisterFunction(worker, "greet", greet); err != nil {
log.Fatal(err)
}
if err := agnt5.RegisterWorkflow(worker, "welcome", welcome); err != nil {
log.Fatal(err)
}
if err := worker.Run(context.Background()); err != nil {
log.Fatal(err)
}
}Run it with agnt5 dev, then trigger the workflow:
agnt5 run welcome --type workflow --input '{"name": "Ada"}'What’s in the SDK
| API | Use it to |
|---|---|
agnt5.RegisterFunction | Register a function: one unit of work with retries and tracing |
agnt5.RegisterWorkflow | Register a workflow |
agnt5.Step, agnt5.Task | Checkpoint work inside a workflow: Step wraps a closure, Task runs a registered function |
agnt5.NewAgent, agnt5.RegisterAgent | Run an agent loop over a language model |
agnt5.RegisterTool | Give an agent a tool it can call |
agnt5.NewWorker | Connect registered components to AGNT5 |
agnt5.NewClient | Run components and evaluate them from your own code |
The github.com/agnt5dev/sdk-go/serverless package serves components as a serverless endpoint.
Next steps
- Getting started: create a project, run it locally, and deploy it.
- Build with AGNT5: guides for functions, workflows, agents, tools, and more, with Go examples on every page.
Modules
- Getting startedCreate a Go AGNT5 project, run it locally with agnt5 dev, and deploy it
- FunctionsRegister typed Go functions with RegisterFunction, configure retries and schemas, and call them from workflows
- WorkflowsRegister Go workflows, checkpoint work with Step and Task, keep state, sleep durably, and attach triggers
- Context APIThe *agnt5.Context every Go handler receives — run details, state, sleep, asking people, logging, events, and model calls
- AgentsCreate Go agents with NewAgent, run them, register them, and hand off between agents
- ToolsDefine Go tools with NewTool, give them a schema, register them, and let agents call them
- LMCreate Go model clients and call language models with ctx.Generate
- WorkerCreate a Go worker, register every component explicitly, and connect it to AGNT5
- ClientRun components, follow runs, run batches, and evaluate components from your own Go code