Go quickstart
A source-correct, no-network first success in Go.
Start with an operation that needs no model, network, identity seed, or wallet. This verifies the actual Go message API before adding a provider or tools.
Prerequisites
Go 1.22 or later. The declared module path is github.com/l1fe-labs/forge-go. Resolve your local checkout with a replace directive if it is not available from your configured module source.
Use a source checkout
The paths below assume the Forge checkout is beside your application. Adjust the local path to your workspace. Registry publication is not inferred from the package name.
go mod init example.com/forge-start
go mod edit -require=github.com/l1fe-labs/forge-go@v0.0.0
go mod edit -replace=github.com/l1fe-labs/forge-go=../forge/forge-go
go mod tidyFirst success
Save this in your application's entry point after resolving github.com/l1fe-labs/forge-go/core.
package main
import (
"fmt"
"github.com/l1fe-labs/forge-go/core"
)
func main() {
message := core.NewTextMessage(core.RoleUser, "Hello, Forge")
if message.TextContent() != "Hello, Forge" {
panic("unexpected message content")
}
fmt.Println(message.TextContent())
}Expected output: Hello, Forge. This checks message construction and text extraction only; it does not call an LLM.
Add an agent
AgentConfig contains a concrete core.LanguageModel, tool registry, limits, optional identity and ACT, approval handler, and telemetry. Run(ctx, prompt) returns (*AgentOutput, error); propagate the request context and check the error before dereferencing output. The result exposes FinalText, Messages, StepsTaken, and Usage.
Verify the source
The example uses declarations from the message declarations. Package metadata comes from forge-go/go.mod.