Amazon Bedrock AgentCore 開発者ガイド学習記録 2日目

Amazon Bedrock AgentCore 開発者ガイド学習記録 2日目

2026/4/24:所要時間 2時間12分

実施範囲

今日の詰まりポイント(いっぱいある)

TypeScriptで動かすところまで行きたかったので、チュートリアル乗っ取りに書いてもいろいろ動かなかった。

Agent: TsAgent

Server: http://localhost:8080/invocations

Status: error

No container runtime found. Install Docker, Podman, or Finch.

ストリートファイター6のアップデートが出来なくてdockerも消したの忘れてた...

dockerがないと起動できません。

ということでインストールして...

Error: Server returned 500

ん?ログを見るとこのエラー

{"statusCode":500},"responseTime":17.344835000112653,"msg":"request completed"}

try~catchで括って確認

Access denied. This Model is marked by provider as Legacy and you have not been actively using the model in the last 30 days. Please upgrade to an active model on Amazon Bedrock

const agent = new Agent(); で使われるのがデフォルトでClaude sonnet 4とのこと

https://strandsagents.com/docs/user-guide/quickstart/typescript/

Bedrockのplaygroundで使えるのかなと確認したら、

  • ResourceNotFoundException

    Access denied. This Model is marked by provider as Legacy and you have not been actively using the model in the last 30 days. Please upgrade to an active model on Amazon Bedrock

使えないのね...

playgroundだけ使えないのか確認するのも面倒なので、使えることが確定しているHaiku 4.5に変更。

anthropic.claude-haiku-4-5-20251001-v1:0

モデルIDにこう書いてあるので

const agent = new Agent({

  model: "anthropic.claude-haiku-4-5-20251001-v1:0",

});

こうして実行。

❌ CredentialsProviderError: Failed to load token from /home/bedrock_agentcore/.aws/login/cache/d934a32aebb45a43da314bc53f2b1d4b43b14cd5041dda65bf63b34f79eb2e30.json: Error: ENOENT: no such file or directory, open '/home/bedrock_agentcore/.aws/login/cache/d934a32aebb45a43da314bc53f2b1d4b43b14cd5041dda65bf63b34f79eb2e30.json' → at LoginCredentialsFetcher.loadToken

認証でエラー。

IAMユーザーにアクセスキーを発行~反映。

aws configure

以下コマンドでアクセスキー・シークレットキー・リージョンを設定、そろそろ動け!

ValidationException: Invocation of model ID anthropic.claude-haiku-4-5-20251001-v1:0 with on-demand throughput isn’t supported. Retry your request with the ID or ARN of an inference profile that contains this model.

指定方法が違うらしい、以下のコマンドで探す。

aws bedrock list-inference-profiles --region ap-northeast-1

正しくは以下でした。

const agent = new Agent({
model: "jp.anthropic.claude-haiku-4-5-20251001-v1:0"
});

そしてついに...

Hello!

無事実行完了、お疲れさまでした。


今日の感想

4/4に試した時からマイナーバージョンが18日で0.6.0→0.9.0に上がっていました。

一昨日やっていた時は0.9.0で、今日は0.10.0になってた。更新頻度が

今日はTypescriptで動かすところまでやろうと思って、到達はした。

チュートリアル通りにやってすんなり動かないというトラップが多い。

手探り感満載ではあるものの、原因追及しながら進めるのは、それはそれで楽しい。

復習が必要。