agent-go

module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0

README

AgentGo

Go Version License Test Coverage zread

Build AI agents in Go. Connect LLMs to tools, chain multiple agents, and deploy as SDK or REST API.

AgentGo lets you create AI agents that call LLM APIs (OpenAI, Anthropic, Gemini, Ollama, etc.), use tools, collaborate in teams, and run structured workflows — all with Go's performance (~180ns agent creation, ~1.2KB memory per agent).

Documentation →


Quick Start

go get github.com/jholhewres/agent-go@latest
SDK Mode
package main

import (
    "context"
    "fmt"
    "os"

    "github.com/jholhewres/agent-go/pkg/agentgo/agent"
    "github.com/jholhewres/agent-go/pkg/agentgo/models/openai"
    "github.com/jholhewres/agent-go/pkg/agentgo/tools/calculator"
    "github.com/jholhewres/agent-go/pkg/agentgo/tools/toolkit"
)

func main() {
    model, _ := openai.New("gpt-4o-mini", openai.Config{
        APIKey: os.Getenv("OPENAI_API_KEY"),
    })

    ag, _ := agent.New(agent.Config{
        Name:     "Assistant",
        Model:    model,
        Toolkits: []toolkit.Toolkit{calculator.New()},
    })

    output, _ := ag.Run(context.Background(), "What is 25 * 4 + 15?")
    fmt.Println(output.Content)
}
AgentOS Mode (REST API)
go run cmd/server/main.go
curl http://localhost:8080/health

See pkg/agentos/README.md for AgentOS documentation.


What It Does

  • Agents — Single agents with LLM + tools (calculator, HTTP, file, custom)
  • Teams — Multi-agent collaboration (sequential, parallel, leader-follower, consensus)
  • Workflows — Step-based orchestration (step, condition, loop, parallel, router)
  • Structured OutputRunTyped[T]() returns typed Go structs from LLM responses
  • Model Fallback — Chain multiple models with automatic retry and fallback
  • Sub-Agents — Spawn child agents or use agents as tools for other agents
  • Guardrails & Hooks — Pre/post tool execution hooks, approval gates, input/output validation
  • 15+ Providers — OpenAI, Anthropic, Gemini, DeepSeek, GLM, Ollama, Groq, and more
  • Session & Memory — Conversation persistence, user learning, history injection

Documentation

Resource Link
Full Documentation https://zread.ai/jholhewres/agent-go
AgentOS API pkg/agentos/README.md
Examples cmd/examples/
Development docs/DEVELOPMENT.md
Changelog CHANGELOG.md

Examples

Example Description
Simple Agent GPT-4o mini + calculator
Structured Output RunTyped[T]() with JSON schema
Fallback Chain Model fallback with retry
Sub-Agent Demo Agent-as-tool + SpawnAll
Team Demo Multi-agent coordination
Workflow Demo Step/Condition/Loop orchestration
RAG Demo ChromaDB + embeddings

Full examples catalog → cmd/examples/


Development

# Run tests
make test

# Format code
make fmt

# Lint
make lint

See docs/DEVELOPMENT.md for complete guidelines.


License

MIT © Contributors


Maintainer: Jhol Hewres

Directories

Path Synopsis
cmd
agentos-session command
examples/tool_hooks_agent command
Example: Agent with Tool Execution Hooks This example demonstrates how to use tool hooks to monitor and control tool execution.
Example: Agent with Tool Execution Hooks This example demonstrates how to use tool hooks to monitor and control tool execution.
examples
batch_upsert command
reasoning command
internal
pkg
agentgo/models/fallback
Package fallback provides a Model implementation that chains multiple models together, falling back to the next model when one fails with a retryable error.
Package fallback provides a Model implementation that chains multiple models together, falling back to the next model when one fails with a retryable error.
agentgo/structured
Package structured provides utilities for generating JSON Schema from Go structs and parsing model responses into typed values.
Package structured provides utilities for generating JSON Schema from Go structs and parsing model responses into typed values.
agentgo/tools/agenttool
Package agenttool wraps an Agent as a Toolkit, allowing one agent to be invoked as a tool by another agent.
Package agenttool wraps an Agent as a Toolkit, allowing one agent to be invoked as a tool by another agent.
agentgo/utils
Package utils provides utility functions for the agno framework utils 包为 agno 框架提供工具函数
Package utils provides utility functions for the agno framework utils 包为 agno 框架提供工具函数
agentos/a2a
Package a2a implements the Agent-to-Agent (A2A) communication protocol based on JSON-RPC 2.0 standard.
Package a2a implements the Agent-to-Agent (A2A) communication protocol based on JSON-RPC 2.0 standard.

Jump to

Keyboard shortcuts

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