Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
デモ実装で考えるStrands Agentsのいいところ
Search
yoko / Naoki Yokomachi
July 22, 2025
1.8k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
デモ実装で考えるStrands Agentsのいいところ
yoko / Naoki Yokomachi
July 22, 2025
More Decks by yoko / Naoki Yokomachi
See All by yoko / Naoki Yokomachi
Code Interpreter で、AIに安全に コードを書かせる。
yokomachi
0
8.6k
Building a Personal AI Agent with Strands Agents × Amazon Bedrock AgentCore
yokomachi
1
37
Strands Agents × Amazon Bedrock AgentCoreで パーソナルAIエージェントを作ろう
yokomachi
3
350
身体を持ったパーソナルAIエージェントの 可能性を探る開発
yokomachi
1
180
AITuberKit+Bedrock AgentCoreで作る 3Dキャラクターエージェント
yokomachi
2
3k
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
400
"人"が頑張るAI駆動開発
yokomachi
1
880
AIハッカソンで1人雰囲気SDDをした学びの共有
yokomachi
1
49
『FailNet~やらかし共有SNS~』エレベーターピッチ
yokomachi
1
610
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
220
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
350
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
730
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Design in an AI World
tapps
1
250
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
250
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Are puppies a ranking factor?
jonoalderson
1
3.6k
How to Ace a Technical Interview
jacobian
281
24k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Unsuck your backbone
ammeep
672
58k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
850
Transcript
2025/07/23 デモ実装で考える デモ実装で考える StrandsAgentsのいいところ StrandsAgentsのいいところ
Profile 名前: 横町直樹 好きなAWSサービス: AWSLambda X: yoko/@_cityside
・StrandsAgents、MCPの概要 ・デモの開発経緯 ・所感 話すこと 話すこと 話さないこと 話さないこと ・StrandsAgents、MCPの詳しい仕様 ・ソースコードの解説 ・AmazonBedrockAgentCore
Agenda やりたかったこと 構成図 実装 まとめ デモ StrandsAgentsのいいところ
やりたかったこと やりたかったこと →全部いっぺんにやろう! ついでにあれとかこれもやりたいし…
デモの要件 ・CloudTrailのAPIをたたいて ユーザーの⾏動履歴を調査するエージェント やりたかったこと やりたかったこと
例えばこんなとき・・・
やばい、なんかやらかして環境壊した とりあえず自分が何やってたか整理しよう
こんなときはCloudTrail でもこの手の調査大変だよな
なるほど、 君は今日〇時〇分にログインして、 このサービスのこの画面でこの作業してたんちゃう?(AI)
作ったもの 作ったもの
構成図 構成図 Strands Agents MCP Ser ver 全部CDKでデプロイ
MCP? MCP? 2025年上期バズワード 「MCP(ModelContextProtocol)」 アプリがLLMに対してコンテキストを与えるためのプロトコル 外部システムと連携する⽅法を標準化する Web検索したりGitHub操作をしたり、ローカルファイルを操作したり… →LLMが必要なタイミングでツールを実⾏ 標準化でアプリケーションを横断したエコシステムが作りやすくなった
MCP:実装 MCP:実装 機能 ・HTTPリクエストを受け付ける ・ツール実⾏のリクエストに応じてCloudTrailのAPIを実⾏して結果を返す ・必要なリソース以外にはアクセスしない
MCP:実装 MCP:実装 機能の実現 ・HTTPリクエストを受け付ける →LambdaWebAdapter+FunctionURLs ・ツール実⾏のリクエストに応じてCloudTrailのAPIを実⾏して結果を返す →FastMCP2.0 ・必要なリソース以外にはアクセスしない →IAMRole
MCP:実装 MCP:実装 Lambda関数 #FastMCPサーバーの初期化(ステートレスモード) mcp=FastMCP(stateless_http=True,json_response=True) #MCPツールの定義。実質CloudTrailのLookupEventsAPIをラップしただけ @mcp.tool deflookup_cloudtrail_events() #FastAPIアプリケーションを取得 app=mcp.http_app()
Dockerfile #CopyAWSLambdaWebAdapter COPY--from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1/lambda-adapter/opt/extensions/lambda-adapter
from strands import Agent agent = Agent( model=model, tools=tools, system_prompt=system_prompt
) Strands Agents? Strands Agents? オープンソースのエージェント開発フレームワーク 👆これだけでAIエージェントが定義できる
モデル駆動 推論・ツール使用 ・応答生成のサイクルを 最先端LLMの性能に委ねるアプローチ 他フレームワークの例: ・LangGraph→Graph ・Mastra→Workflow Strands Agents? Strands
Agents? プ ロ ンプ ト と ツ ー ル 渡 す か ら 自 分 で 判 断 して タ ス ク して ね !
AgenticLoop プロンプト、コンテキスト、使⽤できるツールを渡しながらLLMを呼び出し、 LLMが動的に計画したステップの遂⾏を繰り返すStrandsAgentsのコア機能 StrandsAgents? StrandsAgents? 引⽤元:https://aws.amazon.com/jp/blogs/news/introducing-strands-agents-an-open-source-ai-agents-sdk/
StrandsAgents:実装 StrandsAgents:実装 機能 ・チャットベース ・東京リージョンのClaude3.5SonnetV2 ・ユーザーの要求に応じてMCPツールを実⾏
StrandsAgents:実装 StrandsAgents:実装 機能の実現 ・チャットベース →Streamlit ・東京リージョンのClaude3.5SonnetV2 ・ユーザーの要求に応じてMCPツールを実⾏ →StrandsAgents
StrandsAgents:実装 StrandsAgents:実装 ソースコード(抜粋) #使⽤するモデルの定義 bedrock_model=BedrockModel( model_id= apac.anthropic.claude-3-5-sonnet-20241022-v2:0 , region_name= ap-northeast-1
, temperature=0.7, max_tokens=4000 ) #MCPクライアント、ツールの定義 MCP_URL=os.environ[ MCP_URL ] mcp_client=MCPClient(lambda:streamablehttp_client(MCP_URL)) mcp_tools=mcp_client.list_tools_sync() #エージェントの定義 agent=Agent( model=bedrock_model, tools=all_tools, system_prompt=system_prompt ) #エージェントの応答をストリーミング loop=asyncio.new_event_loop() response=loop.run_until_complete(stream_agent_response(agent,prompt,st.container())) loop.close()
StrandsAgents:実装 StrandsAgents:実装 ファイル全部でこれだけ aws-detective-agent/ ├──app/#エージェントアプリ │├──main.py │├──requirements.txt │├──Dockerfile ├──lambda/#MCPサーバー │├──mcpserver/
││└──main.py │├──Dockerfile │└──pyproject.toml ├──lib/ #CDK │├──config.ts │└──stack.ts ├──bin/ #CDK │└──app.ts └──cdk.json └──package.json
None
MCP:まとめ MCP:まとめ ・CDKによる実装例を作れたのはよかった。モノレポも使いやすい。 ・ProdではMCPサーバーの認証にAPIGatewayやCloudFrontが必要 ・MCPツールのアクセス範囲をIAMロールで定義できるのは体験がいい ・ノンエンジニアでもMCPツールが利⽤しやすい ※ローカルMCPだがLambda⽤MCPサーバーも公開されている AWSLambdaMCPServer https://awslabs.github.io/mcp/servers/lambda-tool-mcp-server/
・UI実装がStreamlit⼀強 →AG-UIのサポートを期待。⼀応ロードマップにはあり →TypeScriptのサポートもロードマップにはあるが時期未定 ほかの選択肢 ・Gradio,Dash,Reflex,Chainlit,etc. →どれも触ったことないのでおススメあれば教えてください! そして今なら… でロジック実装、任意の⾔語でUI実装も楽に? StrandsAgents:まとめ StrandsAgents:まとめ
・⼿軽 →MastraやLangGraphに⽐べて⼀番お⼿軽。 モデル駆動の影響が⼤きい? 今回の範囲は表層of表層 マルチモーダル、マルチエージェント、AWS統合など、公式ツールも沢⼭ StrandsAgents:まとめ StrandsAgents:まとめ
Agent Strands Agentsのいいところ Strands Agentsのいいところ
Agent Strands Agents Strands Agents Strands Agentsのいいところ Strands Agentsのいいところ
「エージェント実装を簡単にし、 ツールやプロンプト、あるいはRAGやメモリ管理… 即ちコンテキストエンジニアリングに時間をかけられる」 というのはStrandsAgentsの価値かもしれない。 StrandsAgentsのいいところ StrandsAgentsのいいところ 引⽤: https://x.com/JnBrymn/status/1946213071476646172
おしまい おしまい 参考 https://strandsagents.com/latest/ https://github.com/jlowin/fastmcp https://github.com/ag-ui-protocol/ag-ui https://github.com/strands-agents/sdk-python https://github.com/awslabs/mcp/blob/main/src/lambda-tool-mcp-server https://aws.amazon.com/jp/blogs/news/introducing-strands-agents-an-open-source-ai-agents-sdk/ https://qiita.com/minorun365/items/dd05a3e4938482ac6055
https://qiita.com/kyuko/items/cb75e8f0a50985ca2030 https://qiita.com/5enxia/items/0dfca327e8f14f0b9d86 https://www.ranthebuilder.cloud/post/mcp-server-on-aws-lambda https://memoribuka-lab.com/?p=4460#google_vignette https://dev.classmethod.jp/articles/aws-lambda-mpc-server/