Strands Agents SDK と Bedrock AgentCore を使って、AI エージェント(自動的に判断して行動するプログラム)の土台を作り、構築します。 次のような場合に使用: - 新しいエージェントプロジェクトを作成する - 白紙の状態から AgentCore アプリケーションを構築する - Strands を使用してエージェントのプロトタイプ(試作品)を作成する - Strands フレームワーク(開発の枠組み)について質問がある TypeScript および Python の両方に対応しています。
Scaffold and build AI agents using the Strands Agents SDK with Bedrock AgentCore. Use when creating new agent projects, building greenfield AgentCore applications, prototyping agents with Strands, or when asked about the Strands framework. Covers both TypeScript and Python.
Strands Agents SDK を使用し、Amazon Bedrock AgentCore 上にデプロイされる AI Agent を構築します。
コードを書く前に、ユーザーに以下を確認してください:
TypeScript か Python か? (新規プロジェクトには TypeScript を推奨 — 強い型付け、優れた開発者体験、Strands の一流サポートがあります。Python も完全サポートされています。)
ユーザーが希望を示さない場合は、TypeScript をデフォルトとします。
動作するデプロイ済み Agent への最短ルートとして、AgentCore Starter Toolkit CLI を使用してください。 設定・デプロイ・メモリプロビジョニング・起動をすべて処理します。
# ツールキットのインストール
pip install bedrock-agentcore-starter-toolkit
# Agent の設定
agentcore configure --entrypoint agent.py --name my-agent
# AWS へのデプロイ(CodeBuild を使用、Docker 不要)
agentcore deploy
# 起動
agentcore invoke '{"prompt": "Hello!"}'
# ステータス確認
agentcore status
# 完了後のリソース削除
agentcore destroy --force
完全な CLI リファレンスは references/agentcore-cli.md を参照してください。
mkdir my-agent && cd my-agent
npm init -y
npm pkg set type=module
npm install @strands-agents/sdk
npm install --save-dev @types/node typescript
完全な TypeScript Agent パターンは references/typescript-patterns.md を参照してください。
mkdir my-agent && cd my-agent
python -m venv .venv && source .venv/bin/activate
pip install strands-agents bedrock-agentcore
完全な Python Agent パターンは references/python-patterns.md を参照してください。
Strands には OpenTelemetry が組み込まれています。 Agent の起動・モデル呼び出し・ツール実行のたびに、OTel スパンが自動的に出力されます。送信先を設定するだけで使えます。
OTEL_EXPORTER_OTLP_ENDPOINT を設定して Jaeger、Grafana、Langfuse 等にルーティングagentcore configure --disable-otel完全なセットアップ・サードパーティバックエンド・トレース属性の設定については references/agentcore-integrations.md を参照してください。
最初のリリースから eval を組み込みましょう。 Strands Evals は LLM-as-a-Judge 評価を提供し、9 種類以上の組み込み Evaluator を備えています:
pip install strands-agents-evals
Eval は Python のみ対応です。TypeScript の Agent であっても、eval スイートは Python で記述してください。
eval のコードパターン・トレースベースの評価・マルチターンシミュレーション・テストケースの自動生成については references/agentcore-integrations.md を参照してください。
| シナリオ | メモリモード | 備考 |
|---|---|---|
| ステートレスなツール呼び出し Agent | NO_MEMORY | 最もシンプルかつ低コスト |
| セッション内でのマルチターン会話 | STM_ONLY | 30 日間保持、会話履歴を保存 |
| セッションをまたいだパーソナライズ | STM_AND_LTM | セッション間で好み・事実・要約を抽出 |
メモリはオプトイン方式です。まずなしで始め、必要になったら追加してください。
agentcore CLI 自体は Python ツールです。TS Agent はコンテナ内で動作します。--deployment-type container を指定してください。global.anthropic.claude-sonnet-4-5-20250929-v1:0 をデフォルトとして使用します。AWS アカウントでモデルアクセスを有効化する必要があります。AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY が設定されているか、IAM ロールを使用していることを確認してください。@strands-agents/sdk には TypeScript のツール入力バリデーション用に Zod がバンドルされています。別途インストールは不要です。agentcore destroy はすべてを削除します — メモリリソースも含めて削除されます。先に --dry-run で確認してください。--idle-timeout と --max-lifetime を設定してください。--disable-otel で無効化してください。callback_handler=None を使用してください。close() が必要 — batch_size > 1 を使用する場合は、必ず with ブロックを使用するか close() を呼び出してください。そうしないとバッファ内のメッセージが失われます。新しい Agent プロジェクトをスキャフォールドする際は、以下を生成してください:
evals/ ディレクトリ — TS Agent であっても Python で記述).gitignoreYou are building an AI agent using the Strands Agents SDK deployed on Amazon Bedrock AgentCore.
Before writing any code, ask the user:
TypeScript or Python? (TypeScript is recommended for new projects — it has strong typing, good DX, and first-class Strands support. Python is fully supported too.)
Default to TypeScript if the user doesn't have a preference.
For the fastest path to a working deployed agent, use the AgentCore Starter Toolkit CLI. It handles configuration, deployment, memory provisioning, and invocation.
# Install the toolkit
pip install bedrock-agentcore-starter-toolkit
# Configure your agent
agentcore configure --entrypoint agent.py --name my-agent
# Deploy to AWS (uses CodeBuild, no Docker needed)
agentcore deploy
# Invoke it
agentcore invoke '{"prompt": "Hello!"}'
# Check status
agentcore status
# Tear down when done
agentcore destroy --force
See references/agentcore-cli.md for the full CLI reference.
mkdir my-agent && cd my-agent
npm init -y
npm pkg set type=module
npm install @strands-agents/sdk
npm install --save-dev @types/node typescript
See references/typescript-patterns.md for complete TypeScript agent patterns.
mkdir my-agent && cd my-agent
python -m venv .venv && source .venv/bin/activate
pip install strands-agents bedrock-agentcore
See references/python-patterns.md for complete Python agent patterns.
Strands has OpenTelemetry built in. Every agent invocation, model call, and tool execution emits OTel spans automatically. You just configure where to send them.
OTEL_EXPORTER_OTLP_ENDPOINT to route to Jaeger, Grafana, Langfuse, etc.agentcore configure --disable-otelSee references/agentcore-integrations.md for full setup, third-party backends, and trace attribute configuration.
Ship evals from day one. Strands Evals provides LLM-as-a-Judge evaluation with 9+ built-in evaluators:
pip install strands-agents-evals
Evals are Python-only. Even for TypeScript agents, write your eval suite in Python.
See references/agentcore-integrations.md for eval code patterns, trace-based evaluation, multi-turn simulation, and auto-generated test cases.
| Scenario | Memory Mode | Notes |
|---|---|---|
| Stateless tool-calling agent | NO_MEMORY | Simplest, cheapest |
| Multi-turn conversation within a session | STM_ONLY | 30-day retention, stores conversation history |
| Personalization across sessions | STM_AND_LTM | Extracts preferences, facts, summaries across sessions |
Memory is opt-in. Start without it, add when you need it.
agentcore CLI itself is a Python tool. Your TS agent runs in a container.--deployment-type container when configuring TS agents with the AgentCore CLIglobal.anthropic.claude-sonnet-4-5-20250929-v1:0 via Bedrock. You need model access enabled in your AWS account.AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY are set, or use IAM roles.@strands-agents/sdk bundles Zod for TypeScript tool input validation. No separate install needed.agentcore destroy deletes everything — including memory resources. Use --dry-run first.--idle-timeout and --max-lifetime during configure if you need longer sessions.--disable-otel if you don't want it.callback_handler=None in eval task functions to suppress console output.batch_size > 1, you MUST use a with block or call close() or buffered messages are lost.When scaffolding a new agent project, generate:
evals/ directory with at least one test case using Strands Evals — Python, even for TS agents).gitignore appropriate for the language原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。