Getting started
A weave program starts a runtime, makes a call, and writes an event to a scroll. This page walks you through that flow end to end — install, first call, and what weave recorded for you.
Install the SDK
Weave ships three language SDKs over a shared Connect RPC wire format — pick the one your app is written in.
go get github.com/zilfi-io/weave@latestConfigure a provider
Weave doesn't ship its own model — it records calls to one. The provider tells the runtime where to send ai.request events and how to capture the response.
Local environment variables (OPENAI_API_KEY, etc.) are
read by the provider by default.
Make your first call
Start the runtime, call ask, and shut it down. The
runtime handle (w) owns the scroll, dispatches the
model call, and commits every event along the way.
package main
import (
"context"
"fmt"
"github.com/zilfi-io/weave"
"github.com/zilfi-io/weave/ai"
"github.com/zilfi-io/weave/providers/openai"
)
func main() {
ctx := context.Background()
w, err := weave.Start(ctx,
weave.WithProvider("openai", openai.New()),
weave.WithDefault("openai", openai.GPT5Nano),
)
if err != nil {
panic(err)
}
defer w.Close()
var answer string
if err := ai.Ask(ctx, w,
"in one word, what does weave record?",
ai.WithResponse(&answer),
); err != nil {
panic(err)
}
fmt.Println(answer)
}Inspect the scroll
That single call produced an ordered event stream. The weave CLI can tail the most recent scroll so you can see what the runtime captured:
$ weave scrolls tail --last=1
ai.request { prompt: "in one word, what does weave record?" }
ai.response { text: "events" }
ai.chunk { delta: "events" }Why three events? ai.request is derived (recomputable from your code plus prior events). ai.response is the non-deterministic
commit — the fact the runtime couldn't reproduce without asking
the model. ai.chunk is the same content
streamed, recorded for UI replay.
Replay it
Feed the recorded ai.response back
into a fresh runtime. Weave skips the network call, returns the
captured value, and your program reaches the same state with zero
tokens spent. This is the basis of weave's test strategy — golden
files, not mocks.