> ## Documentation Index
> Fetch the complete documentation index at: https://adcp-docs-ja.pier1.co.jp/llms.txt
> Use this file to discover all available pages before exploring further.

# get_media_buy_artifacts

> get_media_buy_artifacts は AdCP でポストデリバリーのブランド適合性検証のためにメディアバイからコンテンツコンテキストレコードを取得します。

# get\_media\_buy\_artifacts

検証のため、メディアバイからコンテンツアーティファクトを取得します。パフォーマンス指標を返す `get_media_buy_delivery` とは別で、アーティファクトには広告が表示された実際のコンテンツ（テキスト・画像・動画）が含まれます。

**レスポンスタイム**: \< 5s（アーティファクト 1,000 件バッチ）

## Data Flow

```mermaid theme={null}
sequenceDiagram
    participant Buyer as Buyer Agent
    participant Seller as Seller Agent
    participant Verifier as Verification Agent

    Buyer->>Seller: get_media_buy_artifacts (sampled or full)
    Seller-->>Buyer: Artifacts with content
    Buyer->>Verifier: validate_content_delivery
    Verifier-->>Buyer: Validation results
```

バイヤーはメディアバイと同じパラメータでセラーにアーティファクトを要求します。セラーは合意したサンプリング率に基づいてコンテンツサンプルを返し、バイヤーは検証エージェントで検証します。

## Request

**Schema**: [get-media-buy-artifacts-request.json](https://adcontextprotocol.org/schemas/v3/content-standards/get-media-buy-artifacts-request.json)

| Parameter       | Type                                                                             | Required | Description                                                                                                                                                            |
| --------------- | -------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account`       | [account-ref](/docs/building/by-layer/L2/accounts-and-agents#account-references) | No       | アカウント参照。`{ "account_id": "..." }` または `{ "brand": {...}, "operator": "..." }` を渡す（セラーが暗黙的解決をサポートする場合）。このアカウントに属するメディアバイのアーティファクトのみ返します。省略時は全アクセス可能アカウントのアーティファクトを返します。 |
| `media_buy_id`  | string                                                                           | Yes      | 取得元のメディアバイ ID                                                                                                                                                          |
| `package_ids`   | array                                                                            | No       | 特定パッケージに絞り込み                                                                                                                                                           |
| `failures_only` | boolean                                                                          | No       | セラーのローカルモデルが `local_verdict: "fail"` を返したアーティファクトのみを返します（[unevaluated レコードでの挙動](#failures_only-and-unevaluated-records)を参照）                                            |
| `time_range`    | object                                                                           | No       | 期間で絞り込み                                                                                                                                                                |
| `pagination`    | object                                                                           | No       | ページネーションパラメータ（後述）                                                                                                                                                      |

<Info>
  **サンプリングは取得時ではなく購入作成時に設定されます**。サンプリングレート、メソッド、チャンネルごとの設定は、メディアバイの `governance.content_standards` 合意の一部です。`get_media_buy_artifacts` は、その合意に従ってセラーがすでに収集したアーティファクトを取得します。プッシュ型の配信には、`create_media_buy` で `artifact_webhook` を設定します。
</Info>

### Pagination

アーティファクト結果セットは非常に大きくなり得るため、標準ページネーションよりも高い上限を使います。

| Parameter                | Type    | Default | Description                    |
| ------------------------ | ------- | ------- | ------------------------------ |
| `pagination.max_results` | integer | 1000    | 1 ページあたりの最大アーティファクト数（1〜10,000） |
| `pagination.cursor`      | string  | -       | 前のレスポンスから返された不透明なカーソル          |

## Response

**Schema**: [get-media-buy-artifacts-response.json](https://adcontextprotocol.org/schemas/v3/content-standards/get-media-buy-artifacts-response.json)

### Success Response

```json theme={null}
{
  "$schema": "/schemas/content-standards/get-media-buy-artifacts-response.json",
  "media_buy_id": "mb_nike_reddit_q1",
  "artifacts": [
    {
      "record_id": "imp_12345",
      "timestamp": "2025-01-15T10:30:00Z",
      "package_id": "pkg_feed_standard",
      "artifact": {
        "property_id": {"type": "domain", "value": "reddit.com"},
        "artifact_id": "r_fitness_abc123",
        "assets": [
          {"type": "text", "role": "title", "content": "Best protein sources for muscle building", "language": "en"},
          {"type": "text", "role": "paragraph", "content": "Looking for recommendations on high-quality protein sources...", "language": "en"},
          {"type": "image", "url": "https://cdn.reddit.com/fitness-image.jpg", "alt_text": "Person lifting weights"}
        ]
      },
      "country": "US",
      "channel": "social",
      "brand_context": {"brand_id": "nike_global", "sku_id": "air_max_2025"},
      "local_verdict": "pass"
    },
    {
      "record_id": "imp_12346",
      "timestamp": "2025-01-15T10:35:00Z",
      "package_id": "pkg_feed_standard",
      "artifact": {
        "property_id": {"type": "domain", "value": "reddit.com"},
        "artifact_id": "r_news_politics_456",
        "assets": [
          {"type": "text", "role": "title", "content": "Election Results Analysis", "language": "en"},
          {"type": "text", "role": "paragraph", "content": "The latest polling data shows...", "language": "en"}
        ]
      },
      "country": "US",
      "channel": "social",
      "brand_context": {"brand_id": "nike_global", "sku_id": "air_max_2025"},
      "local_verdict": "fail"
    }
  ],
  "sampling_info": {
    "total_deliveries": 100000,
    "sampled_count": 1000,
    "effective_rate": 0.01,
    "method": "random"
  },
  "pagination": {
    "cursor": "eyJvZmZzZXQiOjEwMDB9",
    "has_more": true
  }
}
```

### Response Fields

| Field                       | Description                                              |
| --------------------------- | -------------------------------------------------------- |
| `artifacts`                 | Array of delivery records with full artifact content     |
| `artifacts[].country`       | ISO 3166-1 alpha-2 country code where delivery occurred  |
| `artifacts[].channel`       | Channel type (display, video, audio, social)             |
| `artifacts[].brand_context` | Brand/SKU information for policy evaluation (schema TBD) |
| `artifacts[].local_verdict` | Seller's local model verdict (pass/fail/unevaluated)     |
| `sampling_info`             | How the sample was generated                             |
| `pagination`                | Cursor for fetching more results                         |

## Use Cases

### 収集したアーティファクトの検証

```python theme={null}
# Get artifacts from seller (sampling was configured at buy creation time)
artifacts_response = seller_agent.get_media_buy_artifacts(
    media_buy_id="mb_nike_reddit_q1"
)

# Convert to validation records
records = [
    {
        "record_id": a["record_id"],
        "timestamp": a["timestamp"],
        "media_buy_id": artifacts_response["media_buy_id"],
        "artifact": a["artifact"],
        "country": a.get("country"),
        "channel": a.get("channel"),
        "brand_context": a.get("brand_context")
    }
    for a in artifacts_response["artifacts"]
]

# Validate against verification agent
validation = verification_agent.validate_content_delivery(
    standards_id="nike_brand_safety",
    records=records
)

# Check for drift between local and verified verdicts
for i, result in enumerate(validation["results"]):
    local = artifacts_response["artifacts"][i]["local_verdict"]
    verified = result["verdict"]
    if local != verified:
        print(f"Drift detected: {result['record_id']} - local={local}, verified={verified}")
```

### Focus on Local Failures

```python theme={null}
# Get only artifacts that failed local evaluation
failures = seller_agent.get_media_buy_artifacts(
    media_buy_id="mb_nike_reddit_q1",
    failures_only=True,
    pagination={"max_results": 100}
)

# Verify these were correctly flagged
validation = verification_agent.validate_content_delivery(
    standards_id="nike_brand_safety",
    records=[{"record_id": a["record_id"], "artifact": a["artifact"]}
             for a in failures["artifacts"]]
)

# Check false positive rate
false_positives = sum(1 for r in validation["results"] if r["verdict"] == "pass")
print(f"False positive rate: {false_positives / len(failures['artifacts']):.1%}")
```

## failures\_only and Unevaluated Records

セラーがローカル評価モデルを実行しない場合、すべてのレコードは `local_verdict: "unevaluated"` になります。この場合、`failures_only` は空の結果セットを返します — 返すべき失敗が存在しないためです。

すべての `local_verdict` が `"unevaluated"` である検証結果を受け取ったガバナンスエージェントは、これを**ローカル強制なし**として扱うべきです。検証自体は機能します — 検証エージェントはアーティファクトを通常どおり評価します — が、実行すべきドリフト比較がありません。バイヤーは購入作成前に [get\_adcp\_capabilities](/docs/protocol/get_adcp_capabilities#content_standards) の `content_standards.supports_local_evaluation` を確認して、`failures_only` が有用かどうかを知ることができます。

| `local_verdict` | `failures_only` は返す？ | ドリフト比較は可能？                                         |
| --------------- | -------------------- | -------------------------------------------------- |
| `fail`          | Yes                  | Yes                                                |
| `pass`          | No                   | N/A（結果セットに含まれない）                                   |
| `unevaluated`   | No                   | No — すべての収集済みアーティファクトを取得するには `failures_only` を省略する |

## Non-Web Artifact Examples

### Podcast

```json theme={null}
{
  "record_id": "imp_podcast_001",
  "timestamp": "2025-02-10T08:00:00Z",
  "package_id": "pkg_mid_roll",
  "artifact": {
    "property_id": {"type": "apple_podcast_id", "value": "1234567890"},
    "artifact_id": "episode_42_segment_3",
    "assets": [
      {"type": "text", "role": "title", "content": "The Future of Running Shoes", "language": "en"},
      {"type": "audio", "url": "https://cdn.example.com/secured/ep42_seg3.mp3", "transcript": "Today we're talking to Dr. Chen about biomechanics research and how it's changing shoe design for marathon runners...", "duration_ms": 480000}
    ],
    "metadata": {
      "json_ld": [{"@type": "PodcastEpisode", "episodeNumber": 42, "name": "The Future of Running Shoes"}]
    }
  },
  "country": "US",
  "channel": "podcast",
  "brand_context": {"brand_id": "nike_global", "sku_id": "vaporfly_next"},
  "local_verdict": "pass"
}
```

### CTV

```json theme={null}
{
  "record_id": "imp_ctv_001",
  "timestamp": "2025-02-10T20:15:00Z",
  "package_id": "pkg_premium_ctv",
  "artifact": {
    "property_id": {"type": "app_id", "value": "com.streamingservice.tv"},
    "artifact_id": "show_running_s2e5_scene_14",
    "assets": [
      {"type": "text", "role": "title", "content": "Championship Race - Final Stretch", "language": "en"},
      {"type": "video", "url": "https://cdn.streaming.example.com/secured/s2e5_scene14.mp4", "transcript": "The runners round the final corner as the crowd erupts. Commentary: 'And she's pulling ahead now, this is going to be close...'", "duration_ms": 120000}
    ]
  },
  "country": "US",
  "channel": "ctv",
  "brand_context": {"brand_id": "nike_global"},
  "local_verdict": "pass"
}
```

### AI-Generated Content

```json theme={null}
{
  "record_id": "imp_ai_001",
  "timestamp": "2025-02-10T14:22:00Z",
  "package_id": "pkg_conversational",
  "artifact": {
    "property_id": {"type": "domain", "value": "chat.example.com"},
    "artifact_id": "session_x7k9_turn_15",
    "assets": [
      {"type": "text", "role": "paragraph", "content": "Based on your training schedule, I'd recommend increasing your long run distance by 10% each week. Here's a 12-week half-marathon plan...", "language": "en"}
    ]
  },
  "country": "GB",
  "channel": "display",
  "brand_context": {"brand_id": "nike_global", "sku_id": "pegasus_41"},
  "local_verdict": "unevaluated"
}
```

注: この AI 生成コンテンツの例が `local_verdict: "unevaluated"` を持つのは、コンテンツが一時的であり、プラットフォームがローカルモデルではなく配信後の検証に依存しているためです。

## Delivery vs Artifacts

| Aspect        | get\_media\_buy\_delivery  | get\_media\_buy\_artifacts |
| ------------- | -------------------------- | -------------------------- |
| **Purpose**   | Performance reporting      | Content validation         |
| **Data size** | Small (metrics)            | Large (full content)       |
| **Frequency** | Regular reporting          | Sampled validation         |
| **Contains**  | Impressions, clicks, spend | Text, images, video        |
| **Consumer**  | Buyer for optimization     | Verification agent         |

## Related Tasks

* [validate\_content\_delivery](./validate_content_delivery) - Validate the artifacts
* [calibrate\_content](./calibrate_content) - Understand why artifacts pass/fail
* [get\_media\_buy\_delivery](../../../media-buy/task-reference/get_media_buy_delivery) - Get performance metrics
