aixgo

package module
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 16 Imported by: 0

README

aixgo

Go Version License Go Report Card

Production-grade AI agent framework for Go. Build secure, scalable multi-agent systems without Python dependencies.

Documentation | Quick Start | Features | Examples | Contributing

Why Aixgo?

Python AI frameworks excel at prototyping but struggle in production. Aixgo is built for systems that ship, scale, and stay running.

Dimension Python Frameworks Aixgo
Deployment 1GB+ containers <10MB binary
Cold Start 10-45 seconds <100ms
Type Safety Runtime errors Compile-time checks
Concurrency GIL limitations True parallelism
Scaling Manual queues/services Built-in channels → gRPC
Key Features
  • 6 Agent Types - ReAct, Classifier, Aggregator, Planner, Producer, Logger
  • 13 Orchestration Patterns - All production-proven patterns implemented
  • 6+ LLM Providers - OpenAI, Anthropic, Gemini, xAI, Vertex AI, HuggingFace, plus local inference
  • Enterprise Security - 4 auth modes, RBAC, rate limiting, SSRF protection
  • Full Observability - OpenTelemetry, Prometheus, Langfuse, cost tracking
  • Cost Optimization - 25-50% savings with Router pattern, 70% token reduction with RAG

📖 Complete Feature Catalog: See docs/FEATURES.md for all features with code references and technical details.

Quick Start

Installation

Choose the installation method based on your use case:

As a Library

For adding Aixgo to your Go project:

go get github.com/aixgo-dev/aixgo

This downloads only the Go framework source code (~2MB), not the website or documentation.

CLI Tools

Option 1: Install via go install (requires Go 1.24+):

# Install all CLI tools
go install github.com/aixgo-dev/aixgo/cmd/orchestrator@latest
go install github.com/aixgo-dev/aixgo/cmd/benchmark@latest
go install github.com/aixgo-dev/aixgo/cmd/deploy@latest
go install github.com/aixgo-dev/aixgo/cmd/tools@latest

# Or install individual tools as needed
go install github.com/aixgo-dev/aixgo/cmd/orchestrator@latest

Option 2: Download pre-built binaries:

Download platform-specific binaries from GitHub Releases. Available for:

  • Linux (amd64, arm64)
  • macOS/Darwin (amd64, arm64)
  • Windows (amd64, arm64)
Full Repository (Contributors)

For contributing or exploring examples:

git clone https://github.com/aixgo-dev/aixgo.git
cd aixgo
go build ./...

This includes the full repository with website source (web/), examples, and documentation.

What You Get
User Type Command What's Included Size
Library user go get github.com/aixgo-dev/aixgo Go source code only ~2MB
CLI user go install or binary download Single executable binary <10MB
Contributor git clone Full repo including web/, examples/, docs/ ~20MB
Setup

Before running your agents, you need to configure API keys for LLM providers. Create a .env file in your project root (or set environment variables):

# Copy the example environment file
cp .env.example .env

# Edit .env and add your API keys
# Required: At least one of these API keys
export OPENAI_API_KEY=sk-...        # For GPT models
export XAI_API_KEY=xai-...          # For Grok models
export ANTHROPIC_API_KEY=sk-ant-... # For Claude models (optional)
export HUGGINGFACE_API_KEY=hf_...  # For HuggingFace models (optional)

The framework will automatically detect the appropriate API key based on your model name:

  • grok-* or xai-* models use XAI_API_KEY
  • gpt-* models use OPENAI_API_KEY
  • claude-* models use ANTHROPIC_API_KEY
  • HuggingFace models (e.g., meta-llama/*) use HUGGINGFACE_API_KEY
Your First Agent

Create a simple multi-agent system in under 5 minutes:

1. Create a configuration file (config/agents.yaml):

supervisor:
  name: coordinator
  model: gpt-4-turbo
  max_rounds: 10

agents:
  - name: data-producer
    role: producer
    interval: 1s
    outputs:
      - target: analyzer

  - name: analyzer
    role: react
    model: gpt-4-turbo
    prompt: |
      You are a data analyst. Analyze incoming data and provide insights.
    inputs:
      - source: data-producer
    outputs:
      - target: logger

  - name: logger
    role: logger
    inputs:
      - source: analyzer

2. Create your main.go:

package main

import (
    "github.com/aixgo-dev/aixgo"
    _ "github.com/aixgo-dev/aixgo/agents"
)

func main() {
    if err := aixgo.Run("config/agents.yaml"); err != nil {
        panic(err)
    }
}

3. Run your agent system:

go run main.go

That's it! You now have a running multi-agent system with producer, analyzer, and logger agents orchestrated by a supervisor.

Use Cases

  • Data Pipelines - Add AI enrichment to high-throughput ETL workflows
  • API Services - Production AI endpoints with Go's performance
  • Edge Deployment - Run AI agents on resource-constrained devices
  • Multi-Agent Systems - Coordinate complex workflows with supervisor patterns

Architecture

Aixgo provides a flexible, layered architecture:

  • Agent Layer - 6 specialized agent types
  • Orchestration Layer - 13 production-proven patterns
  • Runtime Layer - Local (Go channels) or Distributed (gRPC)
  • Integration Layer - 6+ LLM providers, MCP tool calling, vector stores
  • Observability Layer - OpenTelemetry, Prometheus, cost tracking

🔗 Deep Dive: For detailed architecture and pattern documentation, see docs/PATTERNS.md.

Documentation

Comprehensive guides and examples available at aixgo.dev

Resources
  • Website - Comprehensive guides and documentation
  • docs/ - Technical reference documentation
  • examples/ - Production-ready code examples
  • web/ - Website source code
Core Documentation
Examples

Browse 15+ production-ready examples in examples/:

  • Agent types: ReAct, Classifier, Aggregator, Planner
  • LLM providers: OpenAI, Anthropic, Gemini, xAI, HuggingFace
  • Orchestration: MapReduce, parallel, sequential, reflection
  • Security: Authentication, authorization, TLS
  • Complete use cases: End-to-end applications

Development

# Build
git clone https://github.com/aixgo-dev/aixgo.git
cd aixgo
go build ./...

# Test
go test ./...
go test -race ./...

# Coverage
go test -cover ./...

See docs/CONTRIBUTING.md for contribution guidelines.

Contributing

We welcome contributions! See docs/CONTRIBUTING.md for guidelines.

Community

License

MIT License - see LICENSE for details.


Production-grade AI agents in pure Go.

Build AI agents that ship with the same performance, security, and operational simplicity as the rest of your Go stack.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(configPath string) error

Run starts the aixgo agent system from a config file

func RunWithConfig

func RunWithConfig(config *Config) error

RunWithConfig starts the aixgo agent system with the provided config

func RunWithConfigAndRuntime

func RunWithConfigAndRuntime(config *Config, rt agent.Runtime) error

RunWithConfigAndRuntime starts the system with a custom runtime (useful for testing)

func RunWithMCP

func RunWithMCP(configPath string, servers ...*mcp.Server) error

RunWithMCP starts the aixgo agent system with optional MCP servers

func StartAgents

func StartAgents(agents map[string]agent.Agent, agentDefs []agent.AgentDef, rt agent.Runtime) error

StartAgents starts all agents with the given runtime using dependency-aware phased startup. If the runtime supports PhasedStarter interface, agents are started in topological order based on their depends_on declarations. Otherwise, agents are started concurrently.

Types

type Config

type Config struct {
	Supervisor    SupervisorDef     `yaml:"supervisor,omitempty"`
	MCPServers    []MCPServerDef    `yaml:"mcp_servers,omitempty"`
	ModelServices []ModelServiceDef `yaml:"model_services,omitempty"`
	Agents        []agent.AgentDef  `yaml:"agents"`
}

Config represents the top-level configuration

type ConfigLoader

type ConfigLoader struct {
	// contains filtered or unexported fields
}

ConfigLoader loads configuration from a file

func NewConfigLoader

func NewConfigLoader(fr FileReader) *ConfigLoader

NewConfigLoader creates a new config loader with default security limits

func NewConfigLoaderWithLimits

func NewConfigLoaderWithLimits(fr FileReader, limits security.YAMLLimits) *ConfigLoader

NewConfigLoaderWithLimits creates a new config loader with custom YAML security limits

func (*ConfigLoader) LoadConfig

func (cl *ConfigLoader) LoadConfig(configPath string) (*Config, error)

LoadConfig loads and parses a config file with security limits

type FileReader

type FileReader interface {
	ReadFile(path string) ([]byte, error)
}

FileReader interface for reading files (testable)

type MCPAuthDef

type MCPAuthDef struct {
	Type     string `yaml:"type"` // "bearer", "oauth"
	Token    string `yaml:"token,omitempty"`
	TokenEnv string `yaml:"token_env,omitempty"`
}

MCPAuthDef represents MCP authentication configuration

type MCPServerDef

type MCPServerDef struct {
	Name      string      `yaml:"name"`
	Transport string      `yaml:"transport"` // "local" or "grpc"
	Address   string      `yaml:"address,omitempty"`
	TLS       bool        `yaml:"tls,omitempty"`
	Auth      *MCPAuthDef `yaml:"auth,omitempty"`
}

MCPServerDef represents an MCP server configuration

type MockFileReader

type MockFileReader struct {
	// contains filtered or unexported fields
}

MockFileReader is a mock implementation of FileReader for testing

func NewMockFileReader

func NewMockFileReader() *MockFileReader

NewMockFileReader creates a new mock file reader

func (*MockFileReader) AddFile

func (m *MockFileReader) AddFile(path string, content []byte)

AddFile adds a file to the mock file system

func (*MockFileReader) ReadFile

func (m *MockFileReader) ReadFile(path string) ([]byte, error)

ReadFile implements FileReader.ReadFile

func (*MockFileReader) Reset

func (m *MockFileReader) Reset()

Reset clears all files and errors

func (*MockFileReader) SetError

func (m *MockFileReader) SetError(err error)

SetError sets an error to return from ReadFile

type ModelServiceDef

type ModelServiceDef struct {
	Name      string         `yaml:"name"`
	Provider  string         `yaml:"provider"`  // "huggingface", "openai", etc.
	Model     string         `yaml:"model"`     // Model ID
	Runtime   string         `yaml:"runtime"`   // "ollama", "vllm", "cloud"
	Transport string         `yaml:"transport"` // "local", "grpc"
	Address   string         `yaml:"address,omitempty"`
	Config    map[string]any `yaml:"config,omitempty"`
}

ModelServiceDef represents a model service configuration

type OSFileReader

type OSFileReader struct{}

OSFileReader implements FileReader using os.ReadFile

func (*OSFileReader) ReadFile

func (r *OSFileReader) ReadFile(path string) ([]byte, error)

type PhasedStarter added in v0.2.3

type PhasedStarter interface {
	StartAgentsPhased(ctx context.Context, agentDefs map[string]agent.AgentDef) error
}

PhasedStarter is implemented by runtimes that support phased agent startup. This enables dependency-aware startup ordering.

type SimpleRuntime

type SimpleRuntime struct {
	// contains filtered or unexported fields
}

SimpleRuntime is a basic in-memory implementation of the Runtime interface

func NewSimpleRuntime

func NewSimpleRuntime() *SimpleRuntime

NewSimpleRuntime creates a new SimpleRuntime

func (*SimpleRuntime) Broadcast

func (r *SimpleRuntime) Broadcast(msg *agent.Message) error

Broadcast sends a message to all channels (stub implementation for compatibility)

func (*SimpleRuntime) Call

func (r *SimpleRuntime) Call(ctx context.Context, target string, input *agent.Message) (*agent.Message, error)

Call invokes an agent synchronously and waits for response

func (*SimpleRuntime) CallParallel

func (r *SimpleRuntime) CallParallel(ctx context.Context, targets []string, input *agent.Message) (map[string]*agent.Message, map[string]error)

CallParallel invokes multiple agents concurrently and returns all results

func (*SimpleRuntime) Get

func (r *SimpleRuntime) Get(name string) (agent.Agent, error)

Get retrieves a registered agent by name

func (*SimpleRuntime) List

func (r *SimpleRuntime) List() []string

List returns all registered agent names

func (*SimpleRuntime) Recv

func (r *SimpleRuntime) Recv(source string) (<-chan *agent.Message, error)

Recv returns a channel to receive messages from a source

func (*SimpleRuntime) Register

func (r *SimpleRuntime) Register(a agent.Agent) error

Register registers an agent with the runtime

func (*SimpleRuntime) Send

func (r *SimpleRuntime) Send(target string, msg *agent.Message) error

Send sends a message to a target channel

func (*SimpleRuntime) Start

func (r *SimpleRuntime) Start(ctx context.Context) error

Start starts the runtime

func (*SimpleRuntime) StartAgentsPhased added in v0.2.3

func (r *SimpleRuntime) StartAgentsPhased(ctx context.Context, agentDefs map[string]agent.AgentDef) error

StartAgentsPhased starts all registered agents in dependency order. Agents are started in phases based on their dependencies:

  • Phase 0: Agents with no dependencies
  • Phase N: Agents whose dependencies are all in phases < N

Within each phase, agents are started concurrently and the method waits for all of them to report Ready() before proceeding to the next phase.

func (*SimpleRuntime) Stop

func (r *SimpleRuntime) Stop(ctx context.Context) error

Stop gracefully shuts down the runtime

func (*SimpleRuntime) Unregister

func (r *SimpleRuntime) Unregister(name string) error

Unregister removes an agent from the runtime

type SupervisorDef

type SupervisorDef struct {
	Name      string `yaml:"name"`
	Model     string `yaml:"model"`
	MaxRounds int    `yaml:"max_rounds,omitempty"`
}

SupervisorDef represents supervisor configuration

Directories

Path Synopsis
Package agent provides the public interfaces for building agents with Aixgo.
Package agent provides the public interfaces for building agents with Aixgo.
cmd
benchmark command
deploy/cloudrun command
deploy/k8s command
orchestrator command
deploy
cloudrun command
deploy.go - Deploy aixgo to Google Cloud Run Run with: go run deploy.go
deploy.go - Deploy aixgo to Google Cloud Run Run with: go run deploy.go
huggingface-mcp command
rag-agent command
internal
graph
Package graph provides dependency graph operations for agent startup ordering.
Package graph provides dependency graph operations for agent startup ordering.
llm
pkg
llm
mcp
security
Package security provides security utilities for the aixgo framework.
Package security provides security utilities for the aixgo framework.
mcp
tests
e2e

Jump to

Keyboard shortcuts

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