Skip to content

Getting started

This page is for Go engineers embedding core-agent in their own binary. If you just want to run the bundled CLI, head over to Run the CLI → Getting started instead.

Terminal window
go get github.com/go-steer/core-agent/v2

The shortest possible program: pick a provider, build an agent, run one turn.

package main
import (
"context"
"fmt"
"log"
"github.com/go-steer/core-agent/v2/pkg/agent"
"github.com/go-steer/core-agent/v2/pkg/config"
"github.com/go-steer/core-agent/v2/pkg/models"
_ "github.com/go-steer/core-agent/v2/pkg/models/gemini"
)
func main() {
cfg := config.DefaultConfig()
cfg.Model.Provider = config.ProviderGemini
provider, err := models.Resolve(cfg)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
m, err := provider.Model(ctx, cfg.Model.Name)
if err != nil {
log.Fatal(err)
}
a, err := agent.New(m)
if err != nil {
log.Fatal(err)
}
for event, err := range a.Run(ctx, "what's the capital of France?") {
if err != nil {
log.Fatal(err)
}
if event.Content == nil {
continue
}
for _, p := range event.Content.Parts {
if p.Text != "" && event.Partial {
fmt.Print(p.Text)
}
}
}
fmt.Println()
}

This works, but it has no tools, no permissions, no persistence. The rest of the Library guide is about layering those in via extension points.

Every customization happens through one of these interfaces or option functions. The pattern across all of them is the same: core-agent ships sensible defaults; you replace any of them with WithX(yourImplementation).

SurfaceInterfaceWhen you’d extend it
Approvalspermissions.PrompterUI is not a TTY (web, Slack, IDE plugin)
Tool executiontool.Tool (via functiontool.New)Domain operations, internal APIs
Model backendmodels.ProviderLLM not in the box (OpenAI, local Ollama, …)
Remote subagentsbackground.RemoteAgentSpawnerDelegate to K8s Job / Cloud Run / your runtime
Session persistencesession.ServiceBeyond eventlog’s SQLite/Postgres/MySQL
Background workersbackground.ManagerAsync tasks the parent’s model spawns at runtime
Inbound messagesagent.Inject(msg)Push input to a running agent from another goroutine
Tool inspectionautonomous.WithBeforeTurnRate limits, external approvals, custom budgets
Context managementagent.Compactor / agent.CheckpointerCustom summarizer prompts / thresholds
Agentic subtasksagent.RunSubtask + tools/agentic wrappersRoute bulk tool output through a cheap-model subtask
Late-binding hooksagent.WithPostConstructExternal tools whose handler needs the constructed *Agent
  • Tools — the model-facing tool catalog and how to register your own via functiontool.New.
  • Library guide — narrative tour of every extension point above with worked examples. (coming in Phase 2)
  • API reference — exhaustive reference for every exported type and option. (coming in Phase 2)