コンテンツへスキップ
初級
クイックヒント
10分

クイックヒント:より高速なエージェントタスクのために Claude Sonnet 4.6 にアップグレード

Claude Sonnet 4.6 は、よりスマートなエージェント検索を搭載しています——消費トークンが減り、レイテンシが下がり、出力品質は同じです。既存のプロジェクトを10分未満でアップグレードしましょう。

1章 2026年4月更新日:2026年4月6日

Sonnet 4.6 で何が変わった?

Anthropic の Sonnet 4.6 リリース(2026年4月)は、エージェント効率——つまり、モデルが複数ステップのタスク中に情報を検索・取得する方法に焦点を当てています。

よりスマートなコンテキスト保持
複数ステップのタスクで重複した検索を約20〜30%削減します
チャンク単位の結果選択
大きなファイル全体ではなく、関連するセクションを返します
精密なクエリ構成
より絞り込んだ検索クエリ = 処理すべき無関係な結果が減る

さらに新しく:Message Batches API の上限が 1バッチあたり300,000トークン に引き上げられました(Opus 4.6 と Sonnet 4.6 向け)。

ステップ1:モデル文字列を見つける

コードベース内で、現在のモデル識別子を検索します。通常は次のいずれかの場所にあります:

# Search for model string in your project
# In terminal:
grep -r "claude-" src/ --include="*.ts" --include="*.tsx" --include="*.js"

# Common locations:
# - lib/ai.ts or lib/claude.ts
# - app/api/*/route.ts
# - services/llm.ts

通常は claude-sonnet-4-5claude-3-5-sonnet-20241022 のような文字列が見つかります。

ステップ2:Sonnet 4.6 に更新する

古いモデル文字列を claude-sonnet-4-6 に置き換えます:

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const response = await client.messages.create({
  // Before: "claude-sonnet-4-5" or "claude-3-5-sonnet-20241022"
  model: "claude-sonnet-4-6", // ← Change this
  max_tokens: 4096,
  messages: [
    {
      role: "user",
      content: "Your prompt here"
    }
  ]
});
ほとんどのユースケースでは、これで完了です。
新しいモデルに移行すると、エージェント検索の改善は自動的に適用されます。プロンプトの変更は必要ありません。

ボーナス:大規模なタスクには Message Batches API を使う

多数のファイルやレコードを処理する場合、Batches API は1バッチあたり300Kトークンに対応するようになりました——大量のコードレビューやセキュリティ監査に最適です:

const client = new Anthropic();

// Process multiple files in parallel (up to 300K tokens total)
const batch = await client.messages.batches.create({
  requests: filesToReview.map((file) => ({
    custom_id: file.path,
    params: {
      model: "claude-sonnet-4-6",
      max_tokens: 1024,
      messages: [{
        role: "user",
        content: `Review this file for security issues:\n\n${file.content}`
      }]
    }
  }))
});

// Poll until complete
let result = batch;
while (result.processing_status === "in_progress") {
  await new Promise(r => setTimeout(r, 2000));
  result = await client.messages.batches.retrieve(batch.id);
}

// Collect results
for await (const item of client.messages.batches.results(batch.id)) {
  console.log(`${item.custom_id}: ${item.result.type}`);
}

まとめ

  • モデル文字列を claude-sonnet-4-6 に変更する
  • エージェント検索の改善は自動的——プロンプトの変更は不要
  • 複数ステップのエージェントタスクで、冗長な検索が約20〜30%減ると見込めます
  • Batches API は並列処理のために1バッチあたり300Kトークンに対応