API Reference
Complete API reference for Agno-Go v1.0.
Core Modules
- Agent - Autonomous AI agents
- Team - Multi-agent collaboration
- Workflow - Step-based orchestration
- Models - LLM provider integrations
- Tools - Built-in and custom tools
- Memory - Conversation history management
- Types - Core types and errors
- AgentOS Server - Production HTTP server
Quick Links
Agent
go
import "github.com/rexleimo/agno-Go/pkg/agno/agent"
agent.New(config) (*Agent, error)
agent.Run(ctx, input) (*RunOutput, error)
agent.ClearMemory()
Team
go
import "github.com/rexleimo/agno-Go/pkg/agno/team"
team.New(config) (*Team, error)
team.Run(ctx, input) (*RunOutput, error)
// Modes: Sequential, Parallel, LeaderFollower, Consensus
Workflow
go
import "github.com/rexleimo/agno-Go/pkg/agno/workflow"
workflow.New(config) (*Workflow, error)
workflow.Run(ctx, input) (*RunOutput, error)
// Primitives: Step, Condition, Loop, Parallel, Router
Models
go
import (
"github.com/rexleimo/agno-Go/pkg/agno/models/openai"
"github.com/rexleimo/agno-Go/pkg/agno/models/anthropic"
"github.com/rexleimo/agno-Go/pkg/agno/models/ollama"
)
openai.New(modelID, config) (*OpenAI, error)
anthropic.New(modelID, config) (*Anthropic, error)
ollama.New(modelID, config) (*Ollama, error)
Tools
go
import (
"github.com/rexleimo/agno-Go/pkg/agno/tools/calculator"
"github.com/rexleimo/agno-Go/pkg/agno/tools/http"
"github.com/rexleimo/agno-Go/pkg/agno/tools/file"
)
calculator.New() *Calculator
http.New(config) *HTTP
file.New(config) *File
Common Patterns
Error Handling
go
import "github.com/rexleimo/agno-Go/pkg/agno/types"
output, err := agent.Run(ctx, input)
if err != nil {
switch {
case errors.Is(err, types.ErrInvalidInput):
// Handle invalid input
case errors.Is(err, types.ErrRateLimit):
// Handle rate limit
default:
// Handle other errors
}
}
Context Management
go
import (
"context"
"time"
)
// With timeout
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
output, err := agent.Run(ctx, input)
Concurrent Agents
go
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
ag, _ := agent.New(config)
output, _ := ag.Run(ctx, input)
fmt.Printf("Agent %d: %s\n", id, output.Content)
}(i)
}
wg.Wait()
Type Definitions
Core Types
go
// Message types
type Message struct {
Role MessageRole
Content string
Name string
}
// Run output
type RunOutput struct {
Content string
Messages []Message
Metadata map[string]interface{}
}
// Model response
type ModelResponse struct {
Content string
ToolCalls []ToolCall
FinishReason string
}
AgentOS Server API
REST API endpoints for production deployment:
bash
# Health check
GET /health
# List agents
GET /api/v1/agents
# Run agent
POST /api/v1/agents/{agent_id}/run
# Create session
POST /api/v1/sessions
# Get session
GET /api/v1/sessions/{session_id}
OpenAPI Specification
Complete OpenAPI 3.0 specification available:
Examples
See working examples in the repository:
Package Documentation
Full Go package documentation is available on pkg.go.dev: