Skip to content

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()

完全なAgent APIドキュメント →

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

完全なTeam APIドキュメント →

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

完全なWorkflow APIドキュメント →

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)

完全なModels APIドキュメント →

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

完全なTools APIドキュメント →

一般的なパターン

エラーハンドリング

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}

完全なAgentOS APIドキュメント →

OpenAPI仕様

完全なOpenAPI 3.0仕様が利用可能です:

サンプル

リポジトリ内の動作サンプル:

パッケージドキュメント

完全なGoパッケージドキュメントはpkg.go.devで確認できます:

pkg.go.dev/github.com/rexleimo/agno-Go

Released under the MIT License.