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

# Python SDK

> エージェントのトレースを Agent Lens に送信する CoreWeave Forge Python SDK のリファレンスです。

CoreWeave Forge Python SDK (`coreweave`) は、エージェントの会話、ターン、LLM Call、ツール呼び出し、サブエージェントを OpenTelemetry のスパンとして記録し、Agent Lens にエクスポートします。このリファレンスでは、SDK バージョン 0.1.0b0 について説明します。

<h2 id="install">
  インストール
</h2>

SDK を使用するには、Python 3.10 以降が必要です。

```bash theme={"system"}
pip install coreweave
```

プロバイダーの SDK を自動的にトレースするには、対応する extra をインストールします。

```bash theme={"system"}
pip install "coreweave[openai]"
pip install "coreweave[anthropic]"
pip install "coreweave[google-genai]"
```

<h2 id="import-and-initialize">
  インポートと初期化
</h2>

トレースモジュールをインポートし、`entity/project` 形式で project を指定して [`init`](/ja/products/agent-lens/reference/python-sdk/setup#init) を呼び出します。`api_key` を指定しない場合、`init` は `WANDB_API_KEY` 環境変数から APIキーを読み込みます。

```python theme={"system"}
from coreweave.forge.agentlens import tracing

tracing.init("[ENTITY]/[PROJECT]")
```

<h2 id="reference-pages">
  リファレンスページ
</h2>

<h3 id="setup">
  セットアップ
</h3>

| ページ | 内容 |
| - | - |
| [セットアップとシャットダウン](/ja/products/agent-lens/reference/python-sdk/setup) | `init`、`force_flush`、`shutdown`、`TracingSession` |

<h3 id="spans">
  スパン
</h3>

| ページ | 対象 |
| - | - |
| [Conversation](/ja/products/agent-lens/reference/python-sdk/conversation) | `Conversation` |
| [Turn](/ja/products/agent-lens/reference/python-sdk/turn) | `Turn` |
| [LLM](/ja/products/agent-lens/reference/python-sdk/llm) | `LLM` |
| [Tool](/ja/products/agent-lens/reference/python-sdk/tool) | `Tool` |
| [SubAgent](/ja/products/agent-lens/reference/python-sdk/subagent) | `SubAgent` |
| [スパン関数](/ja/products/agent-lens/reference/python-sdk/span-functions) | `start_conversation`, `start_turn`, `start_llm`, `start_tool`, `start_subagent`, `end_conversation`, `end_turn`, `end_llm`, `get_current_conversation`, `get_current_turn`, `get_current_llm` |

<h3 id="batch-logging">
  バッチでログする
</h3>

| ページ | 内容 |
| - | - |
| [バッチでログする](/ja/products/agent-lens/reference/python-sdk/batch-logging) | `log_turn`、`log_conversation`、`LogResult` |

<h3 id="messages">
  メッセージ
</h3>

| ページ | 内容 |
| - | - |
| [メッセージのタイプ](/ja/products/agent-lens/reference/python-sdk/message-types) | `Message`, `MessagePart`, `TextPart`, `ReasoningPart`, `ToolCallPart`, `ToolCallResponsePart`, `BlobPart`, `UriPart`, `FilePart`, `Usage`, `Reasoning`, `MediaAttachment` |

<h3 id="provider-integrations">
  プロバイダーインテグレーション
</h3>

| ページ | 内容 |
| - | - |
| [インテグレーション](/ja/products/agent-lens/reference/python-sdk/integrations) | `autopatch`, `disable_autopatch`, `patch_openai`, `unpatch_openai`, `patch_anthropic`, `unpatch_anthropic`, `patch_google_genai`, `unpatch_google_genai`, `unpatch_all` |
