> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 使い方

> Go Agent SDKでツールループ、人によるレビュー、再試行、再開可能なエージェントを実行します。

## ランタイムを準備する

Agent SDKのGoモジュールはまだ公開バージョンがありません。[ソースからのインストール手順](./agent-sdk-installation.mdx)に従ってください。

## クイックスタート

```go theme={null}
package main

import (
  "context"
  "fmt"

  phaseoagent "github.com/phaseoteam/Phaseo/packages/sdk/agent-sdk-go"
)

func main() {
  client, err := phaseoagent.CreateGatewayAgentClient(phaseoagent.GatewayAgentClientOptions{})
  if err != nil {
    panic(err)
  }

  agent := phaseoagent.CreateAgent(phaseoagent.AgentDefinition{
    ID:           "quickstart-agent",
    Model:        "openai/gpt-5.4-nano",
    Instructions: "Answer concisely and helpfully.",
  })

  result, err := agent.Run(context.Background(), phaseoagent.RunOptions{
    Input:  "Give me one fun fact about cURL.",
    Client: client,
  })
  if err != nil {
    panic(err)
  }

  fmt.Println(result.Output)
}
```

## 提供される機能

* `CreateAgent(...)`
* `DefineTool(...)`
* `CreateGatewayAgentClient(...)`
* Phaseoの`responses` APIを使った、上限付きツールループ

## 高度なランタイム機能

Goはバリデーターと承認、HITL・手動ツール、進捗、回復可能なエラー、再生可能なチャネル、停止ヘルパー、動的ターン、永続化された`NextTurnParams`、正規化された使用量とコスト、`StateAccessor`に対応します。

## ストリーミングとキャンセル

`Agent.Stream(...)`と`Agent.ContinueStream(...)`はゲートウェイのResponses SSEストリームを消費します。複数のコンシューマーで再生するには`Text()`や`Events()`を複数回読み、`Cancel()`でリクエストコンテキストをキャンセルします。完了したステップにはリクエストID、プロバイダーメタデータ、終了理由、警告、使用量、コストが保持されます。

## 関連情報

* [Agent SDKの概要](../agent-sdk/overview.mdx)
* [TypeScript Agent SDK](../typescript/agent-sdk.mdx)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.