serve

command
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package main provides a reference AG-UI HTTP server that exposes a gains agent via the AG-UI protocol over Server-Sent Events (SSE).

This server demonstrates how to integrate gains with AG-UI compatible frontends like CopilotKit. It uses only the Go standard library for HTTP.

Configuration is via environment variables:

AGUI_PORT         - Server port (default: 8000)
AGUI_LOG_LEVEL    - Log level: debug, info, warn, error (default: info)
GAINS_PROVIDER    - Provider: anthropic, openai, google, or vertex (required)
GAINS_MODEL       - Model override (optional, uses provider default)
GAINS_MAX_STEPS   - Max agent iterations (default: 10)
GAINS_TIMEOUT     - Agent timeout (default: 2m)
GAINS_DEMO_TOOLS  - Enable demo tools (default: true)
ANTHROPIC_API_KEY - Anthropic API key
OPENAI_API_KEY    - OpenAI API key
GOOGLE_API_KEY    - Google API key
VERTEX_PROJECT    - Vertex AI project ID
VERTEX_LOCATION   - Vertex AI location (e.g., us-central1)

Usage:

GAINS_PROVIDER=anthropic go run ./cmd/serve
GAINS_PROVIDER=vertex VERTEX_PROJECT=my-project VERTEX_LOCATION=us-central1 go run ./cmd/serve

Debug logging (shows all events):

AGUI_LOG_LEVEL=debug GAINS_PROVIDER=anthropic go run ./cmd/serve

Jump to

Keyboard shortcuts

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