A framework that treats agent runs as evidence.

Go-first framework for dependable AI agents: typed dependencies and outputs, explicit tools, observable runs — verified by a 19-check live harness.

quick start
client, err := openai.New(openai.Config{
    APIKey: os.Getenv("OPENAI_API_KEY"),
    Model:  "gpt-4o-mini",
})
agent, err := golem.New[struct{}, string](client,
    golem.DecodeFunc[string](func(_ context.Context, r model.Response) (string, error) {
        return r.Message.Content, nil
    }),
)
result, err := agent.Run(ctx, golem.RunContext[struct{}]{}, "Reply with exactly the word: pong")
Versionv0.6.0 · additive API
LanguageGo 1.26+ · stdlib only
Verification19 live checks
Providers15 adapters + MCP
The contract

Every run carries its evidence.

A run doesn't just return text. Each call returns the typed output, the full normalized conversation as durable, additive-only JSON (result.Messages), and cumulative token, request, and tool-call usage. Failures return a RunError with an inspectable stage — model, tool, decode, loop, or usage — that preserves the underlying cause for errors.Is and errors.As. Debugging an agent becomes reading a value, not replaying logs.

Capabilities

What the core covers.

Typed agents & outputs

Generic agents with typed dependencies and decoded, validated results.

Structured output

Schema mode and tool mode — including where providers reject schema + tools together.

Tools with typed dependencies

Explicit tool declarations, forced tool choice, per-tool deadlines.

Ordered parallel execution

Opt-in parallel tool calls that keep deterministic ordering.

Self-correction

Output and tool validation loops with bounded retries.

Fallbacks & retries

Retry with backoff and fallback models per run.

Streaming

Streaming on every adapter, including Bedrock.

Bounded runs

History trimming, token/request/tool-call usage limits.

Multimodal input

Image input alongside text conversations.

Agent delegation

Compose agents that call other agents as tools.

MCP client

Bridge external server tools over stdio or streamable HTTP.

Common tools

Web fetch, file read, and command execution out of the box.

Provider adapters: OpenAI-compatible APIs (twelve services), Anthropic, Google Gemini, Azure OpenAI, and AWS Bedrock — plus an MCP client so external tool servers join the same typed tool loop.

Verification

Shipped with the harness that proves it.

Every capability above maps to a live check that runs against a real provider (Gemini by default). The harness doubles as the docs: deterministic offline checks pass without a key, live checks skip rather than fail, and each one either works or says so.

verification harness (golem-lab)
go run . verify                  # full live suite
go run . verify --offline-only   # deterministic, no key
go run . verify --list           # catalog all 19 checks
go run . verify structured self-correction   # filter by substring
Design decisions

Go-native, deliberately.

01

Compile-time contracts

Typed dependencies and outputs catch at build time what other frameworks discover at runtime. No Python-style metaprogramming ports.

02

Explicit over magic

context.Context, explicit error handling, and small interfaces. Model calls, tool execution, iteration limits, and usage are visible in the run result.

03

Replaceable infrastructure

Applications choose models, tracing, storage, and transport through narrow interfaces — never hard-wired to a vendor.

04

A small public API

Additive changes only until v1. The foundation brief gates every new public abstraction.

Get started

One dependency: the standard library.

install
go get github.com/abubakarsiddik31/golem

# verify every capability against a live provider
git clone https://github.com/abubakarsiddik31/golem-lab
cd golem-lab && GEMINI_API_KEY=... go run . verify

Golem needs Go 1.26.5 or newer and depends only on the Go standard library — adapters for specific providers are separate imports, so your dependency tree stays honest.