basic

command
v2.8.0-dev.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README

basic — minimal library agent in ~50 lines

What this shows

The smallest useful embedding of core-agent as a Go library: resolve a model provider from config, construct an agent.Agent with a one-line instruction, and iterate the streaming event sequence from a single Run call, printing partial text as it arrives. No tools, no session persistence, no CLI — just the model round-trip.

Run it

Needs real Gemini credentials:

GOOGLE_API_KEY=... go run ./examples/basic

from the repo root.

Key APIs

  • agent.New / agent.WithInstructiongithub.com/go-steer/core-agent/v2/pkg/agent
  • agent.Agent.Run — returns an iter.Seq2[*Event, error] you range over
  • models.Resolvegithub.com/go-steer/core-agent/v2/pkg/models
  • config.DefaultConfiggithub.com/go-steer/core-agent/v2/pkg/config
  • blank import of pkg/models/gemini to register the provider

What you should see

A single streamed answer, printed token-by-token as partials arrive:

The capital of France is Paris.

Next

Documentation

Overview

Example: minimal multi-turn agent using the core-agent library directly (no CLI). Uses Gemini by default; export GOOGLE_API_KEY before running:

GOOGLE_API_KEY=... go run ./examples/basic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL