Strands Agents SDKを試してみました。
Thrilled to see @awscloud making a major contribution to the open source AI community with the launch of the Strands Agents, an open source AI agents SDK! https://t.co/Wl2OYYrlZT
— Swami Sivasubramanian (@SwamiSivasubram) May 16, 2025
The core of Strands is the simple agentic loop that connects the model and tools together, like the… pic.twitter.com/PsW2Z3rGOk
スワミ博士がオープンソース AI エージェント SDK である Strands Agentsについてポストされていたので、さっそく試してみました。
AWS公式ブログはこちらです。
「オープンソースのAIエージェントSDK、Strands Agentsのご紹介」とあるように新しい生成AIが発表された訳ではなくて、生成AIをプログラムで扱っていくのに便利なSDK、プログラムのまとまりが公開されたと理解しました。
こちらのStrands Agents SDKの一番初めのWelcomeを試しました。
pip install strands-agentsとあるので、Python実行環境が必要ですが、すぐに試せそうな環境は何かを考えてみて、私はAWSのCloudShellで実施することにしました。

いきなりエラーが表示されました。ChatGPTに相談すると(そこはGenUじゃないんかい)バージョンについて説明してくれました。


Strands Agents
Strands Agentsを動かすのにPythonのバージョンは3.10以上が必要と分かりました。ChatGPT先生に相談しながら、CloudShellにインストールとpyenv のインストール、そして設定ファイル bashrc を編集しました。
from strands import Agent
# Create an agent with default settings
agent = Agent()
# Ask the agent a question
agent("Tell me about agentic AI")プログラムを公式サイトからコピペして、python -u agent.pyを実行しました。
python -u agent.py結果はこちらです。

# Agentic AI
Agentic AI refers to artificial intelligence systems designed to act autonomously on behalf of users to accomplish specific goals. Unlike more passive AI systems that simply respond to direct queries, agentic AI can:
- Take initiative and perform actions independently
- Make decisions based on goals and context
- Plan multi-step processes to achieve objectives
- Learn from outcomes to improve performance
## Key characteristics
- **Goal-oriented**: Works toward specific outcomes rather than just responding to inputs
- **Autonomous**: Can operate with minimal human supervision
- **Adaptive**: Adjusts strategies based on changing conditions
- **Persistent**: Continues working toward goals over time
## Current applications
Early forms of agentic AI include personal assistants that can book appointments, research topics, automate workflows, or manage digital tasks. More advanced systems might handle business processes, scientific research assistance, or personalized learning plans.
## Considerations
The development of agentic AI raises important questions about alignment with human values, appropriate levels of autonomy, and governance structures to ensure these systems act responsibly and transparently.
Would you like me to explore any particular aspect of agentic AI in more depth?
# エージェントAI
エージェントAIとは、ユーザーに代わって特定の目標を達成するために自律的に動作するように設計された人工知能システムを指します。直接的な問い合わせに応答するだけの受動的なAIシステムとは異なり、エージェントAIは以下の機能を備えています。
- 主体的に行動し、自律的に行動する
- 目標と状況に基づいて意思決定を行う
- 目標達成のために段階的なプロセスを計画する
- 結果から学習し、パフォーマンスを向上させる
## 主な特徴
- **目標指向**: 入力に応答するだけでなく、特定の結果を目指して行動する
- **自律**: 最小限の人間による監視で動作可能
- **適応型**: 変化する状況に基づいて戦略を調整する
- **持続型**: 時間の経過とともに目標達成に向けて動作し続ける
## 現在の応用例
初期のエージェントAIには、予約、調査テーマの選定、ワークフローの自動化、デジタルタスクの管理などを行うパーソナルアシスタントが含まれます。より高度なシステムとしては、ビジネスプロセス、科学研究支援、個別学習プランの作成などが考えられます。
## 考慮事項
エージェントAIの開発は、人間の価値観との整合性、適切なレベルの自律性、そしてこれらのシステムが責任を持って透明性を持って機能することを保証するガバナンス構造といった重要な問題を提起します。
エージェントAIの特定の側面について、より深く掘り下げて検討してみたいことはありますか?
次にサンプルコードの質問文を日本語に置き換えたもので試しました。
注釈によると、生成AIはClaude 3.7 Sonnetが読み込まれているそうです。

最後に、ChatGPT先生に聞きながら引数に質問文を与えると生成AIが返してくれるようにプログラムstrands-talk.pyを作成しました。
CloudShell内でAmazon Qが使えるはずなのですが調べきれませんでした。
import sys
from strands import Agent
# コマンドライン引数を取得(2番目の引数。0はスクリプト名、1は最初の引数)
if len(sys.argv) > 1:
user_input = sys.argv[1]
else:
user_input = "あなたはAIアシスタントです。何か気の利いた自己紹介を返してください。" # デフォルトの文字列
# Create an agent with default settings
agent = Agent()
# Ask the agent a question
agent(user_input)実行コマンド例です。
python -u strands-talk.py はじめまして、AIさん。簡単に自己紹介をお願いしします。
Strands Agents SDKのQuickstartページはこちらです。

さらに改良して、生成AIのモデルも引数で指定できるようにしました。
import sys
from strands import Agent
# コマンドライン引数を取得(2番目の引数。0はスクリプト名、1は最初の引数)
if len(sys.argv) > 1:
user_input = sys.argv[1]
model_input = sys.argv[2]
else:
user_input = "あなたはAIアシスタントです。何か気の利いた自己紹介を返してください。" # デフォルトの文字列
model_input = "us.anthropic.claude-3-7-sonnet-20250219-v1:0" # デフォルトのモデル
# Create an agent with default settings
agent = Agent(model=model_input)
# Ask the agent a question
agent(user_input)上記プログラムのコマンド実行例です。現時点で最新の生成AIであるAmazon Nova Premierを指定してみました。
python -u strands-talk-model.py こんにちは us.amazon.nova-premier-v1:
Alexa開発を思い出しました。Alexa+のSDKはこんな感じかもしれません。
気軽に試せたので、個人開発で試していきたいです。
