1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS Bedrock Agent Core

1
Posted at

インストール

pip install bedrock-agentcore-starter-toolkit

プロジェクト作成

agentcore create

エージェント名、CDKを使うか、LLMのプロバイダーをどこを使うかを選択する。
src/model/load.pyにどこのモデルを使うか定義されている。安いモデルに変更する。

MODEL_ID = "global.amazon.nova-2-lite-v1:0"

ローカルで開発する場合

AWSアクセスキーとシークレットを環境変数で指定してローカルの開発モードで起動

cd echoGray
$Env:AWS_ACCESS_KEY_ID="アクセスキー"
$Env:AWS_SECRET_ACCESS_KEY="シークレットキー"
$Env:AWS_DEFAULT_REGION="us-west-2"
agentcore dev

ローカルで呼び出す

agentcore invoke --dev "こんにちは、自己紹介して"

basic starter project (recommended)を選んだ場合

デプロイ

cd echoNavy
agentcore configure
(OAuth2.0で認証する場合はconfigureで設定)
agentcore deploy

OAuth2.0の情報は、エージェントンタイム→バージョン1→インバウンド認証に設定される。
20260211-agentcore01.png

呼び出し先のURLは、"https://bedrock-agentcore.us-west-2.amazonaws.com/runtimes/{URLエンコードされたAgentRuntimeのARN}/invocations?qualifier=DEFAULT" のようになる。
呼び出し

agentcore invoke  "こんにちは、自己紹介して"

削除
https://docs.aws.amazon.com/bedrock/latest/userguide/agents-delete.html

cd echoNavy
agentcore destroy

CDKを選んだ場合

AgentCoreで動くコンテナはARM64だけなためechoGray/DockerfileにARM64を書き足す

FROM  --platform=linux/arm64 ghcr.io/astral-sh/uv:python3.14-bookworm-slim

AWSのクラウドにCDKでデプロイする

cd echoGray/cdk
npm install
npm run cdk bootstrap
npm run cdk synth
npm run cdk:deploy

呼び出し

agentcore invoke  "こんにちは、自己紹介して"
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?