API 레퍼런스
Agno-Go v1.0의 완전한 API 레퍼런스입니다.
핵심 모듈
- Agent - 자율 AI 에이전트
- Team - 다중 에이전트 협업
- Workflow - 단계 기반 오케스트레이션
- Models - LLM 제공자 통합
- Tools - 내장 및 커스텀 도구
- Memory - 대화 기록 관리
- Types - 핵심 타입 및 에러
- AgentOS Server - 프로덕션 HTTP 서버
빠른 링크
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)
// 모드: 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)
// 원시 연산: 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
일반적인 패턴
에러 처리
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):
// 잘못된 입력 처리
case errors.Is(err, types.ErrRateLimit):
// 속도 제한 처리
default:
// 기타 에러 처리
}
}
Context 관리
go
import (
"context"
"time"
)
// 타임아웃 설정
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
output, err := agent.Run(ctx, input)
동시 에이전트
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()
타입 정의
핵심 타입
go
// 메시지 타입
type Message struct {
Role MessageRole
Content string
Name string
}
// 실행 출력
type RunOutput struct {
Content string
Messages []Message
Metadata map[string]interface{}
}
// 모델 응답
type ModelResponse struct {
Content string
ToolCalls []ToolCall
FinishReason string
}
AgentOS Server API
프로덕션 배포를 위한 REST API 엔드포인트:
bash
# 헬스 체크
GET /health
# 에이전트 목록
GET /api/v1/agents
# 에이전트 실행
POST /api/v1/agents/{agent_id}/run
# 세션 생성
POST /api/v1/sessions
# 세션 조회
GET /api/v1/sessions/{session_id}
OpenAPI 명세
완전한 OpenAPI 3.0 명세를 확인하세요:
예제
저장소의 실제 작동 예제를 참고하세요:
패키지 문서
전체 Go 패키지 문서는 pkg.go.dev에서 확인할 수 있습니다: