AI最新ニュース 2026.05.12
Claude Code v2.1.139〜163 アップデート解説|AWS Bedrock正式対応・エージェント決済・更新手順
v2.1.139〜163の主要変更一覧
| 変更 | 内容 |
|---|---|
| AWS Bedrock GA | プレビュー→正式提供に昇格 |
| Agent Payments | 決済API連携のプレビュー機能追加 |
| /goalモード改善 | 長時間タスクの安定性向上 |
| API Billing Warning | 利用額アラートの追加 |
アップデート方法
# バージョン確認
claude --version
# 最新版にアップデート
npm install -g @anthropic-ai/claude-code
# 特定バージョンに固定
npm install -g @anthropic-ai/claude-code@2.1.163
# 更新確認
claude --version
# → Claude Code 2.1.163
AWS Bedrock経由でClaudeを使う(GA設定)
# bedrock_setup.sh
# AWS Bedrockを使う環境設定
# 1. AWS CLIでcredentialsを設定
aws configure
# → AWS Access Key ID: [your-key]
# → AWS Secret Access Key: [your-secret]
# → Default region name: us-east-1
# → Default output format: json
# 2. IAMでBedrock権限を付与(AWSコンソールで設定)
# 必要なポリシー: AmazonBedrockFullAccess
# 3. Bedrock経由でClaude Codeを起動
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1
claude
# または一行で起動
CLAUDE_CODE_USE_BEDROCK=1 AWS_REGION=us-east-1 claude
# bedrock_claude.py
# PythonからAWS Bedrockを使ってClaudeを呼ぶ
import boto3
import json
def claude_via_bedrock(prompt: str, model_id: str = "anthropic.claude-sonnet-4-5-v1:0") -> str:
"""AWS Bedrock経由でClaudeを呼び出す"""
bedrock = boto3.client(
service_name="bedrock-runtime",
region_name="us-east-1",
)
body = json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 1024,
"messages": [{"role": "user", "content": prompt}]
})
response = bedrock.invoke_model(
modelId=model_id,
body=body,
)
result = json.loads(response["body"].read())
return result["content"][0]["text"]
# 使用例
answer = claude_via_bedrock("Pythonで素数判定関数を書いて")
print(answer)
# Bedrockのモデルリスト確認
bedrock = boto3.client("bedrock", region_name="us-east-1")
models = bedrock.list_foundation_models(byProvider="Anthropic")
for m in models["modelSummaries"]:
print(f"{m['modelId']}: {m['modelName']}")
エージェント決済(Agent Payments)の概念
# agent_payments_concept.py
# エージェントが決済を実行するパターン(概念実装)
import anthropic
import json
client = anthropic.Anthropic()
# 決済ツールを定義
PAYMENT_TOOL = {
"name": "process_payment",
"description": "商品の支払いを処理する",
"input_schema": {
"type": "object",
"properties": {
"amount_jpy": {"type": "integer", "description": "支払い金額(円)"},
"product": {"type": "string", "description": "商品名"},
"reason": {"type": "string", "description": "購入理由"},
},
"required": ["amount_jpy", "product", "reason"]
}
}
def process_payment(amount_jpy: int, product: str, reason: str) -> dict:
"""実際の決済処理(本番ではStripe等を使用)"""
print(f"⚠️ 決済確認: {product} {amount_jpy:,}円 - {reason}")
# 実際にはStripe APIなどを呼ぶ
# stripe.PaymentIntent.create(amount=amount_jpy, currency="jpy")
return {"status": "success", "transaction_id": "txn_demo_001"}
def purchasing_agent(task: str) -> str:
"""購買エージェント:必要に応じて決済を実行する"""
messages = [{"role": "user", "content": task}]
while True:
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=512,
tools=[PAYMENT_TOOL],
system="あなたは購買担当エージェントです。必要な物品を判断して購入できます。",
messages=messages,
)
if response.stop_reason == "end_turn":
return response.content[0].text
if response.stop_reason == "tool_use":
messages.append({"role": "assistant", "content": response.content})
tool_results = []
for block in response.content:
if block.type == "tool_use":
result = process_payment(**block.input)
tool_results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": json.dumps(result),
})
messages.append({"role": "user", "content": tool_results})
# 注意: 本番環境では人間の確認ステップを必ず挟む
result = purchasing_agent("事務用品のA4コピー用紙500枚を発注して")
あわせて読みたい
- Claude Code インストール完全ガイド【2026年版】
- 【2026年5月】Ollama・LangChain・Claude Code最新アップデートまとめ
- Claude Code サブエージェント並列実行ガイド