Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
どうしてStrands Harnessはトークンコストを抑えられるのさ?
Search
Tatsuya
October 19, 2026
Technology
54
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
どうしてStrands Harnessはトークンコストを抑えられるのさ?
Tatsuya
October 19, 2026
More Decks by Tatsuya
See All by Tatsuya
その英語学習、AWSで代替できませんか?
suzutatsu
2
480
Other Decks in Technology
See All in Technology
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
440
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
1k
Local CI × GitHub Actions
gogutan
3
230
フィンテック養成勉強会#68
finengine
0
150
ウォンテッドリーの最近のプロダクトと技術の紹介
stomk
0
130
AI コーディングと人間の認知スループット / CTO Night & Day 2026 Morning Session / AI Coding and Human Cognitive Throughput
prog893
5
1.3k
パスキーの自動テストはどこまでいけるのか
teamlab
PRO
0
280
QA4AI 2026-Oct 生成AI時代の品質保証
tokuty
1
890
Optunaの最新リリースv5.0について
pfn
PRO
0
120
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.3k
Refining Active Record
shugo
0
160
専門領域のAIをどう評価するか
bengo4com
2
290
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Between Models and Reality
mayunak
4
500
The World Runs on Bad Software
bkeepers
PRO
72
12k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
We Have a Design System, Now What?
morganepeng
55
8.4k
Into the Great Unknown - MozCon
thekraken
41
2.8k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Transcript
#ToBeAWSJrChampions2027 どうして Strands Harnessは トークンコストを抑えられるのさ? 2026年10月19日 鈴木辰弥(すずたつ)
自己紹介 鈴木 辰弥(す ずたつ) (X:@tatsupoyo37685) • • • • •
所属:SIer(社会人2年目エンジニア) 業務:電力系グローバルPJの開発支援 趣味:ライブ/フェス参戦 好きなAWSサービス:AWS CloudFormation 入門中の技術スタック:Strands Agents
話すこと/話さないこと • 話すこと ◦ Strands Harnessの概要 ◦ Strands Harnessのトークンコストを削減する3つのメカニズム •
話さないこと ◦ Strands Harnessが提供する組み込み機能の詳細 ◦ トークンコスト削減のベストプラクティス
アジェンダ • Strands Harness とは • トークンコストを削減する3つのメカニズム • まとめ
高効率エージェントを提供: Strands Harness • 他のハーネス(エージェントを動かす実行基盤)と比較して、 Strands harnessはコストが28%(⇒34%)低い Strands Harnessってなに? どうしてトークンコスト削減できてるの?
https://strandsagents.com/blog/introducing-strands-harness/
Strands Agents とは AWS発のAIエージェントを構築できるオープンソース SDK • Python/TypeScript対応で、エージェントを迅速に構築可能 • ツール/メモリ/セッション/コンテキスト管理などの構成部品を提供 •
部品を追加することで、独自のエージェントを構築可能
Strands Harness とは 1行で構築できる “完成形”のAgentを提供 • システムプロンプト/ツール/セッション管理/メモリ/コンテキスト管理が最初か ら設定済み • create_harness()
のわずか1行で実運用向けのエージェントが構築 • 優れたトークン効率 ⇒3つのコスト削減メカニズムが存在
メカニズム①:コンテキストの自動要約 • コンテキスト使用率が 85%に達すると、古いターンを要約 ⇒直近3件と一番古い1件を残し、それ以外の会話履歴全体を要約 コンテキスト変換前(コンテキスト使用率 85%超) コンテキスト変換後(要約済) [ [
{ "role": "user", "content": [{ "text": "フレームワークベスト3を調査して"}]}, { "role": "assistant", "content": [{ "text":"エージェント構築で代表的な…"}]}, { "role": "user", "content": [{ "text":"特徴と違いを詳しく教えて"}]}, { "role": "assistant", "content": [{ "text":"詳細解説… \n| 焦点 | 設計... | ... (長文Markdown比較表)"}] }, { "role": "user", "content": [{ "text":"メリットとデメリットは?"}]}, { "role": "assistant", "content": ["text": "メリット・デメリットの解説…"]}, { "role": "user", "content": ["text":"どのようなユースケース…"]} ] { "role": "user", "content": [ { "text": "フレームワークベスト3を調査して" }, { "text": "[Summarized: 3 messages, ~203 tokens]\n\nThe assistant explained... 1. Architecture-Based... 2. Event-Driven... 3. Agent-Oriented Simulation..." }, { "text": "メリットとデメリットは?" } ] }, { "role": "assistant", "content": ["text": "メリット・デメリットの解説…"]}, { "role": "user", "content": ["text":"どのようなユースケース…"]} ]
メカニズム②: Tool実行結果の最適化 • 1,500トークン超のTool実行結果は真ん中の文章を切り詰め、前後の文章と 参照キー(toolUseId)のみをコンテキストに保持 ログ取得Tool実行結果(1,500トークン超) Agentが保持するコンテキスト(最適化後) [2026-10-12 22:00:01] INFO
[MainThread] [Truncated: 1 block, ~1,806 tokens] [2026-10-12 22:00:01] INFO [MainThread] Starting application server on port 8080... Starting application server on port 8080... [2026-10-12 22:00:02] DEBUG [InitWorker] Loading configurations from /etc/app/config.yaml ... (中略:ログ出力が続く ) … [2026-10-12 22:30:15] ERROR [PaymentWorker] Transaction timeout occurred for tx_id=987654321. Rolling back… [2026-10-12 22:30:16] ERROR [PaymentWorker] Database deadlock detected on table 'orders'. Aborting transaction. ... [... 5,410 chars elided ...] … [2026-10-12 22:30:16] ERROR [PaymentWorker] Database deadlock detected on table 'orders'. Aborting transaction. [Stashed] [ref:{toolUseId}] 必要時に参照 (retrieve_context) ストレージに退避 toolUseId
メカニズム③:プロンプトキャッシング • Cache Pointを追加することで、指定位置までのプロンプトがキャッシュ対象となる。 Cache Point 追加前のリクエスト { Cache Point
追加後 (Bedrock上のClaudeモデル) { "toolConfig": { "tools": [ {"toolSpec": "search_aws"}, {"toolSpec": "get_cost"} ] }, "system": [ {"text": "あなたはAWSの専門家です"} ], "messages": [ {"role": "user", "content": [ {"text": "Prompt Cacheについて教えて"} ]} ] "toolConfig": { "tools": [ {"toolSpec": "search_aws"}, {"toolSpec": "get_cost"}, {"cachePoint": {"type":"default"}} ] }, "system": [ {"text": "あなたはAWSの専門家です"}, {"cachePoint": {"type":"default"}} ], "messages": [ {"role": "user", "content": [ {"text": "Prompt Cacheについて教えて"}, {"cachePoint": {"type":"default"}} ]} ] } } tools Tool definitions ↓ Cache Point ① ↓ system System Prompt ↓ Cache Point ② ↓ messages 固定された過去の会話 ↓ Cache Point ③
メカニズム③:プロンプトキャッシング ① 初回リクエスト: Cache PointまでをCache Write { { "toolConfig": {
"tools": [ {"toolSpec": "search_aws"}, {"toolSpec": "get_cost"}, {"cachePoint": {"type":"default"}} ] }, "system": [ {"text": "あなたはAWSの専門家です"}, {"cachePoint": {"type":"default"}} ], "messages": [ {"role": "user", "content": [ {"text": "Prompt Cacheについて教えて"}, {"cachePoint": {"type":"default"}} ]} ] } ② 2回目以降のリクエスト: キャッシュに共通部分があれば Cache Read 順番に確認 tools Tool definitions ↓ Cache Point ① ↓ system System Prompt ↓ Cache Point ② ↓ messages 固定された過去の会話 ↓ Cache Point ③ "toolConfig": { "tools": [ {"toolSpec": "search_aws"}, {"toolSpec": "get_cost"}, ] }, "system": [ {"text": "あなたはAWSの専門家です"}, ], "messages": [ {"role": "user", "content": [ {"text": "Prompt Cacheについて教えて"}, ]}, ・・・ {"role": "user", "content": [ {"text": "新規ユーザープロンプト"}, ]} ] } 共通する部分は Cache Read(安い) 新規入力は 通常のInput処理
まとめ • Strands Harnessは「コンテキストを効率的に扱う」ことで トークンコストを削減 1. コンテキストの自動要約 ⇒ 圧迫した過去の会話を要約 2.
Tool実行結果の最適化 ⇒ 不要なTool実行結果を退避 3. プロンプトキャッシング ⇒ 繰り返し使う部分をCache Readで再利用 • トークンコストを抑えたエージェント開発の第一歩にStrands Harness