Strands Agents と Amazon Bedrock を活用したマルチエージェント社会知能
AWS と Strands Agents を活用したマルチエージェントシステムによる社会的情報分析の自動化手法と、Thrad.ai における実装事例が紹介されている。
キーポイント
マルチエージェントによる信号統合の必要性
単一の AI エージェントでは処理しきれない多様なソースからの信号を、専門化されたエージェント群で収集・分析し、クロスソースパターンを特定するアプローチが示されている。
Thrad.ai の実装事例と課題解決
Thrad.ai は従来 1 件あたり 30〜45 分かかっていたリード調査プロセスを自動化し、複数のソース(Reddit, Hacker News など)から得られた信号を統合して購入意欲の高い見込み客を特定するシステムを構築した。
オーケストレーションパターンの比較評価
Swarm と Graph の 2 つのオーケストレーションパターンを、レイテンシ、コスト、メール品質の観点でベンチマークし、最適なアーキテクチャ選択の指針を提供している。
実運用に向けたガバナンスとスコアリング
重み付け基準による prospect スコアリング、意図分類、時間減衰機能、および本番環境でのガバナンス制御など、実用化に必要な詳細な技術要件が解説されている。
信号の三角測量によるスコアリング
分析エージェントは少なくとも2つの独立したソースからの相関証拠を必要とし、24時間以内の信号には1.5倍の重み付けを行うことで、プロモーション目的のノイズをフィルタリングし、高品質なリードを特定します。
SwarmとGraphのオーケストレーション比較
Swarmは動的なハンドオフで複雑な状況に対応可能ですがトークン消費が増大する一方、Graphは並列実行と条件付きエッジにより処理時間を半減させ、予測可能なワークフローを提供します。
Pydanticによる厳格な出力検証
各エージェントは独自の責任範囲とツールを持ち、Pydanticで定義された型安全なスキーマに基づいてのみ次のステップへデータを渡すことで、システム全体の信頼性を確保しています。
重要な引用
Each signal alone is noise, but correlated across sources, they reveal a prospect ready to buy.
A single AI agent can't solve this: the signal diversity is too broad, the source APIs too varied, and the analysis too nuanced for one model to handle well.
With multi-agent orchestration, you assign each source to a specialist agent, then fuse results through a dedicated analysis agent that spots cross-source patterns.
The scoring relies on signal triangulation: a prospect needs correlated evidence from at least two independent sources.
A window of 8 with a minimum of 3 unique agents forces forward progress.
Choose Graph when the workflow is repeatable and you need predictable latency. Choose Swarm when input quality varies and agents need to adapt.
影響分析・編集コメントを表示
影響分析
この記事は、LLM を活用した営業活動の効率化において、従来の単一エージェントアプローチの限界を打破し、マルチエージェントシステムの実装パターンと評価基準を具体的に示す重要な指針となっています。特に AWS エコシステム内での実用事例とベンチマークデータを提供することで、企業における AI 導入の意思決定やアーキテクチャ設計に即座に活用可能な知見をもたらします。
編集コメント
単なる技術紹介に留まらず、具体的なビジネス課題(リード調査の非効率化)に対する解決策と、その実装におけるアーキテクチャ選択の根拠(ベンチマーク比較)が示されており、現場のエンジニアやアーキテクトにとって非常に価値の高い実践記事です。
見込み顧客は、複数の情報源にまたがって足跡を残しています。例えば、ある創業者が r/SaaS で「X には何を使うべきか?」と質問する一方で、その製品が Hacker News でローンチされ、Stack Overflow の質問数が急増し、GitHub リポジトリのスター数が 2,400 を突破します。これらのシグナルを一つずつ見ればノイズに過ぎませんが、複数の情報源で相関関係があれば、「購入準備完了」の顧客であることが浮き彫りになります。
Strands Agents と Amazon Bedrock AgentCore を活用したマルチエージェントシステムを使えば、こうしたソーシャルインテリジェンスを大規模に自動化できます。
Thrad.ai は AI 向けの広告インフラを構築し、LLM(大規模言語モデル)内で有料広告を導入しています。同社のプラットフォームでは、チャットインターフェースが広告を通じて収益化できるようになり、ブランドもそこで広告を出稿可能です。しかし Thrad.ai が直面したのは、特にシグナルの多いこの課題でした。
これらのパターンを手動で追跡するのはスケーラブルではなく、文脈を欠いた一般的なアプローチでは、メールを開封する価値さえ生み出せません。Thrad.ai の営業チームは、1 通のアウトレッチメールを作成するために、6 つの情報源にわたって各リードの調査に 30〜45 分を費やしていました。
単一の AI エージェントではこの課題を解決できません。シグナルの多様性が広すぎ、ソース API の種類が多すぎるためです。また、分析には高度なニュアンスが必要で、1 つのモデルがすべてを適切に処理するのは困難です。
マルチエージェントによるオーケストレーションを採用すれば、各情報源を担当する専門のエージェントに割り当て、それらの結果を統合してクロスソースのパターンを検出する専用分析エージェントが機能します。
本記事では、Thrad.ai が Strands Agents と Amazon Bedrock AgentCore を活用し、見込み客の発見からパーソナライズされたメール作成までのパイプラインを自動化するマルチエージェントシステムをどのように構築したかを紹介しています。
記事では、レイテンシ、コスト、メールの質における直接比較ベンチマークを通じて、2 つのオーケストレーションパターン(Swarm と Graph)を対比します。また、重み付け基準や意図分類、時間経過による減衰を用いた見込み客の評価方法と、本番環境での運用に必要なガバナンス制御についても解説します。
これらのパターンは、競合調査や候補者発掘、市場リサーチなどにも応用可能です。詳しく追いかけるための コンパニオンリポジトリ も用意されています。
前提条件
本記事では、Python や AWS Cloud Development Kit (AWS CDK) の基礎知識、そして大規模言語モデル(LLM)の概念についてある程度の理解があることを想定しています。
Amazon Bedrock(Claude Sonnet 4.6 モデル有効化済み)および Amazon Bedrock AgentCore にアクセスできる AWS アカウントが必要です。
また、Amazon DynamoDB、AWS Lambda、AWS Secrets Manager、AWS CDK に対する権限も用意してください。
実行環境としては、Python 3.12 以上と Node.js 18 以上が必須です。
必要なパッケージは以下の通りです:strands-agents>=1.25.0、bedrock-agentcore[strands-agents]>=1.2.1、pydantic>=2.12.5
ハンズオンでのデプロイには約 60 分を要し、かかる費用は Amazon Bedrock のモデル呼び出し分として約 3 ドルから 5 ドルを見込んでおいてください。
重要:デプロイしたリソース(DynamoDB テーブル、Lambda 関数、AgentCore サービス)は稼働中に課金が発生します。チュートリアル完了後は必ず「クリーンアップ」手順を実行し、継続的なコストがかからないようにしてください。
注釈: デプロイを行わずに本記事の概念を理解することも可能です。ただし、実際にコードを動かす場合は上記の前提条件を満たしている必要があります。
補完リポジトリをクローンする
git clone https://github.com/aws-samples/sample-multi-agent-social-intelligence-strands-agentcore
cd sample-multi-agent-social-intelligence-strands-agentcore
uv を使って依存関係をインストールする
uv sync
インフラストラクチャを展開する
cd infra && cdk deploy --all
完全なセットアップガイド: README.md
ソリューションの概要
図 1 に示すアーキテクチャを用いれば、生のソーシャル信号を自動的にパーソナライズされた outreach(アプローチ)に変換できます。発見、情報補完、スコアリング、メール生成という 4 つの専門的なエージェントがそれぞれ担当し、各エージェントには独自のツールと厳格な出力検証機能が備わっています。

Amazon Bedrock AgentCore のランタイム、ゲートウェイ、メモリ、観測機能を活用した 4 つのエージェントからなるパイプライン
各エージェントの役割、利用するツール、および使用される AgentCore サービスは以下の通りです。
| エージェント | 役割 | ツール | AgentCore サービス |
|---|---|---|---|
| トレンド調査 | 注目の新製品リリースや購入意欲のシグナルを発見する | Hacker News, YouTube, dev.to, ProductHunt, Reddit, Stack Overflow の API | ランタイム、ゲートウェイ |
| 検索スペシャリスト | 文脈を加味してプロスペクト(見込み顧客)のプロファイルを充実させる | Wikipedia, GitHub, Lobste.rs, Stack Overflow の API | ランタイム、ゲートウェイ |
| 分析 | プロスペクトとトレンドの組み合わせに 0〜100 のスコアを付与する | スコアリングエンジン、ICP(理想顧客像)マッチャー | ランタイム、メモリ |
| メール生成 | パーソナライズされた outreach メールの下書きを作成する | ブランド知識の検索、リード情報の保存 | ランタイム、ゲートウェイ、メモリ |
2 つのエージェントが並列でデータ収集を開始します。トレンド調査エージェントは、Hacker News, YouTube, dev.to, ProductHunt, Reddit, Stack Overflow の 6 つのソースを照会し、注目の新製品リリースや購入意欲を示すシグナルを探します。一方、検索スペシャリストエージェントは、Wikipedia, GitHub, Lobste.rs, Stack Overflow を活用して、各プロスペクトのプロファイルを文脈とともに充実させます。
両方のエージェントが完了すると、分析用エージェントが Amazon Bedrock 上で Claude Sonnet 4.6 を使用し、各見込み顧客とトレンドの組み合わせを 0 から 100 のスコアで評価します。この際、グローバル推論プロファイル(global.anthropic.claude-sonnet-4-6)が利用され、リクエストは最も近い利用可能なリージョンへルーティングされます。これにより、IAM ポリシーに特定のリージョン固有のモデル ARN を記述する必要がなくなり、マルチリージョン展開がスムーズに行えます。
スコアの高い見込み顧客はメール生成用エージェントへと引き継がれ、特定のトレンドに関連したパーソナライズされたメール文面が作成されます。同時に、各ドラフトがブランドガイドラインに準拠しているか検証も実施されます。
各エージェントには責任とツールセット、そして Pydantic で検証された出力契約(データ構造の定義)が 1 つずつ割り当てられています。Pydantic は Python のデータ検証ライブラリであり、実行時に型安全なスキーマを強制します。もしエージェントが誤った形式のデータを返した場合でも、次のエージェントが処理する前にシステム側で検知・捕捉されます。
Reddit ツールは r/SaaS、r/startups、r/devtools、r/selfhosted、r/Entrepreneur の 5 つのサブレディットをスキャンし、キーワードのパターンマッチングを通じて投稿を「推奨を求める」「競合への不満」「製品発表」「購入意図」の 4 つの意図カテゴリに分類します。例えば、Hacker News で製品が発表されたにもかかわらず、Reddit の「何を使うべきか?」というスレッドにも同じ話題が登場する場合、その見込み顧客の評価スコアはより高くなります。
スコアリングは、信号の三角測量に基づいています。つまり、見込み顧客には少なくとも 2 つの独立したソースからの相関する証拠が必要です。
Trend Research Agent はまず check_existing_leads を呼び出し、すでにパイプラインにある見込み顧客をスキップします。Hacker News でトレンドになっている投稿でも、Reddit の議論がなく、Stack Overflow での活動もゼロで、GitHub のスター数もなければ、それは単なるプロモーションの押し売りである可能性が高いです。システムは分析にトークンを消費する前にこれをフィルタリングします。
Analysis Agent は、5 つの加重基準を適用します。トピックの整合性(25%)、タイミングの関連性(20%)、エンゲージメントの可能性(20%)、意図のシグナル(20%)、データの質(15%)です。Ideal Customer Profile (ICP) のマッチングでは、オープンソースでの存在感があり B2B 志向を持つ開発者向けツールに対して最大 10 ポイントのボーナス点が加算されます。
時間経過による減衰もスコアを鋭くします。24 時間以内のシグナルは 1.5 倍の重みを持ち、7 日以上前のシグナルは 0.5 倍になります。
Strands のオーケストレーション:Swarm と Graph
ここからが中核的な設計判断です。4 つのエージェントをどう連携させるか。Strands Agents は、2 つのオーケストレーションパターンを提供しています。Thrad.ai は両方のパターンを実装し、同じ 50 の見込み顧客という負荷条件下で比較検証しました。
以下のセクションでは各パターンの仕組みを解説し、最後にベンチマーク結果を示します。
Swarm:自律的な引継ぎ
図 2 は、共有コンテキストを介して「handoff_to_agent」ツールを用いてエージェントが制御権を引き渡す様子を示しています。Swarm のオーケストレーションでは、エージェントは動的にこのツールを使って制御権を移譲します。
トレンド調査エージェントが潜在的な顧客(プロスペクト)を発見すると、それを検索専門家に引き渡し、情報の補完を行います。次に検索専門家が分析担当者に引き渡し、スコアリングを実施させます。もしデータが不足している場合、分析担当者は追加の文脈情報を得るために、再びトレンド調査エージェントへ引き戻すことも可能です。
これらのエージェントは共通の作業メモリを共有しています。

共有作業メモリを介した動的なエージェント間の引継ぎ
Swarm のエージェントは、共有コンテキストを持つ自律的な同僚として機能し、各エージェントが自ら判断して専門家に制御権を引き渡します。具体的には、トレンド調査エージェントがプロスペクトを発見して検索専門家へ引き渡し、検索専門家が分析担当者に引き渡すという流れです。
もしデータ量が不足している場合、分析担当者は再度トレンド調査エージェントへ「戻り」を要求し、より多くの文脈情報を取得します。この双方向の引継ぎ機能により、必要に応じて追加の文脈情報をリクエストすることが可能になります。
以下のコードは、安全性の制約を設定した Swarm の構成例を示しています:
手渡しのパラメータ設定は繰り返されるプロセスにおいて重要です。これらがなければ、2 つのエージェントが互いに往復し続ける無限ループに陥る可能性があります。例えば、ウィンドウサイズを 8 に設定し、かつ最小限のユニークエージェント数を 3 以上に制限することで、処理が前向きに進むように制御できます。
Swarm は、課題の複雑さが変動する状況や、エージェントが以前の段階へ再参加して恩恵を受けられる場合に最も効果を発揮します。ただし、実行パスの予測は難しくなり、手渡しのための推論オーバーヘッドによりトークン消費量が増加する傾向があります。
グラフ:構造化されたワークフロー
図 3 は、並列的な調査と検索エントリポイントから始まり、分析で収束し、条件付きエッジを通じてメール送信へ至る有向グラフの仕組みを示しています。グラフオーケストレーションでは、エージェントは固定された有向ワークフローに従います。「トレンド研究」と「検索スペシャリスト」が並列のエントリポイントとして機能し、「分析」は両方のタスク完了を待ってから実行されます。また、条件付きエッジによってメール生成が制御され、見込み顧客のスコアが 60 以上の場合のみ実行されるようになっています。

並列エントリ、全依存関係完了によるゲート制御、スコア閾値に基づく条件付き実行
グラフパターンは、エージェントを明示的な一方通行のエッジで固定されたワークフローに接続します。これにより「トレンド研究」と「検索スペシャリスト」が並列処理され、データ収集にかかる時間を半分に短縮できます。「分析」タスクは両方の完了を待機し、「メール送信」は見込み顧客のスコアが 60 を超えた場合のみ実行されるポリシーゲートとして機能します。
以下のコードでは、並列エントリポイントと条件付きエッジを持つグラフの定義方法を示しています。
builder = GraphBuilder()
builder.add_node(trend_agent, "research")
builder.add_node(search_agent, "search")
builder.add_node(analysis_agent, "analysis")
builder.add_node(email_agent, "email")
builder.set_entry_point("research")
builder.set_entry_point("search")
wait_for_both = _all_dependencies_complete(["research", "search"])
builder.add_edge("research", "analysis", condition=wait_for_both)
builder.add_edge("search", "analysis", condition=wait_for_both)
builder.add_edge("analysis", "email", condition=_score_above_threshold)
Graph は、ワークフローが反復可能で監査可能性が重視される場合に真価を発揮します。すべての実行は同じパスをたどるため、同じ入力データを再生することで失敗を再現できます。ただし、明示的なフィードバックエッジがない限り動的にループバックすることはできません。エージェントがより多くの文脈を必要とする場合は、有向非巡回グラフ(DAG)定義内に専用のフィードバックエッジを追加する必要があります。
直接比較結果
両方のパターンを、50 の Hacker News 見込み顧客に対してそれぞれ 3 回実行しました。2 人のレビューアが、メールの関連性について「具体性」「トーン」「正確性」を基準とした 1 から 10 の評価尺度で採点を行いました。
| 指標 | Swarm | Graph |
|---|---|---|
| 見込み顧客あたりの平均レイテンシ | 45 秒 | 32 秒 |
| P95 レイテンシ | 78 秒 | 38 秒 |
| 見込み顧客あたりの平均トークン数 | 〜12,000 | 〜8,500 |
| メール関連性(人間評価) | 8.2 | 7.6 |
| 見込み顧客あたりのコスト(推定) | 〜$0.08 | 〜$0.06
ビジネスへの影響: 1,000件の見込み顧客を対象としたバッチ処理において、Graph は Swarm と比較して約 3.6 時間の処理時間を短縮し、トークンコストを 20 ドル削減しました。
Swarm はデータが不足した際にもエージェントが文脈を取得するためにループ処理を行うため、メールメッセージの品質は高く(8.2 vs 7.6)、一方 Graph はレイテンシの上限が厳しく設定されているため、顧客あたりのコストを 25% 削減できました。Thrad.ai では、夜間のバッチ処理には Graph を、高価値な見込み顧客に対する週次の詳細分析には Swarm を使い分けています。
選択基準: ワークフローが反復的で、予測可能なレイテンシが必要な場合は Graph を選びます。入力品質にばらつきがあり、エージェントが状況に応じて適応する必要がある場合は Swarm を選びましょう。両者は同じコードベースで実行可能で、設定フラグの切り替えだけで使い分けることができます。
Amazon Bedrock AgentCore でのデプロイ
本番環境のワークロードでは、ローカルでのプロトタイピングを超えたセッションの分離、キャパシティ管理、観測性が求められます。Amazon Bedrock AgentCore は、これらの機能をマネージドサービスとして提供します。CDK スタック(インフラストラクチャを定義するクライアント側のオーケストレーションコード)は、aws-cdk-lib/aws-bedrock-agentcore-alpha の L2 構成要素を使用して、4 つのサービスをデプロイします:
ランタイムは、AWS Identity and Access Management (IAM) による認証とライフサイクル制御(アイドル状態から15分、最大8時間)を備えた孤立したマイクロVM(軽量な仮想マシン)上でエージェントを実行します。
ゲートウェイは、9 つのツールに対して単一の Model Context Protocol (MCP) エンドポイントを提供します。MCP は LLM とツールの通信のための標準プロトコルです。エージェントは起動時に Strands MCPClient を介してツールを動的に発見します。
メモリ機能は、セッション内の短期コンテキストと、セッションを超えた長期のセマンティックデータを保存します。これはオプションであり、なくてもエージェントは段階的に機能を低下させるように設計されています。
観測機能は、テレメトリデータのオープン標準である OpenTelemetry を通じて分散トレースを収集し、スパンレベルでのレイテンシやトークン数を計測します。Amazon CloudWatch やサードパーティ製サービスとの連携も可能です。
Thrad.ai の調査では、YouTube API への呼び出しが全体のレイテンシの40%を占めていることが判明しました。このトレースデータに基づき、チームは HTTP 呼び出しに指数バックオフ機能を持つ get_with_retry を追加しました。
**
このブログ記事用の コンパニオン README と AgentCore ドキュメント には、CDK スタック全体、ゲートウェイの設定方法、デプロイの手順が記載されています。
ウォークスルー:実際の実行例
以下は、現在の Hacker News フィードに対して Graph が生成した結果です:
[Graph] 開始ノード:research, search(並列実行)
[research] トレンドの HN ポスト 12 件と Reddit の意図シグナル 4 件を抽出し、AI 関連のローンチ 3 件に絞り込み
[search] 対象 3 社について情報を補完:GitHub のスター数、Wikipedia の文脈、Lobste.rs での議論内容
[Graph] すべての依存関係が完了 → analysis(分析)開始
[analysis] 対象 3 社の評価スコア算出:
- Prospect A(AI コードレビューツール): 88/100、意図:推奨情報を求めている
- Prospect B(ML モニタリングダッシュボード): 61/100、意図シグナルなし
- Prospect C(LLM 微調整 CLI ツール): 45/100、閾値未満のためスキップ
[Graph] 条件分岐:スコアが 60 以上 → email(メール送信)開始(Prospect A, B のみ)
[email] 2 通の個別対応メールを生成し、DynamoDB に保存
以下は、Prospect A 向けに生成されたメールの例です。
件名:HN で話題になっている AI コードレビューツール、拝見しました
[Name] 様、
今週、GitHub のスター数が 2,400 を突破されたとのこと、おめでとうございます。AI コードレビューツールとしてこの成長は素晴らしいものです。
r/SaaS スレッドで開発者たちが「[競合他社]」の代替案を求めている姿を見かけましたが、[Name] 様のアプローチにある文脈に応じた提案機能は、まさに彼らの不満を解消するものだと感じました。
私たちは、テックチームがスケーリングする際のデベロッパー向けアウトリーチ支援ツール「Thrad」を開発しています。顧客様は、[Name] 様のようなシグナルを具体的な商談へと変換するために Thrad を活用されています。
同様の開発者向けツールの創業者様が販売サイクルを短縮した事例について、15 分ほどお話しできれば幸いです。
よろしくお願いいたします。
[Sender]
Prospect A は、HN、Reddit、dev.to といった複数の情報源からのシグナルを統合した結果、88 点を獲得しました。また、ICP(理想顧客像)に合致する GitHub のスター数が 2,400 あり、すべてのシグナルが 48 時間以内の最新データであることも評価されました(時系列重み付けは 1.5 倍)。一方、Prospect C は 60 点未満だったため除外され、約 3,000 トークンの節約につながりました。Graph パターンは、対象となる 50 の見込み顧客すべてを処理しました。
原文を表示
Your prospects leave trails across multiple sources: a founder asks “What should I use for X?” in r/SaaS while their product launches on Hacker News. Stack Overflow questions spike. A GitHub repo crosses 2,400 stars. Each signal alone is noise, but correlated across sources, they reveal a prospect ready to buy. Multi-agent systems built with Strands Agents and Amazon Bedrock AgentCore can automate this social intelligence at scale.
Thrad.ai is building the advertising infrastructure for AI, introducing paid ads in LLMs. Their platform lets chat interfaces monetize through ads and lets brands advertise in them. They faced an especially signal-rich version of this problem. Tracking these patterns manually doesn’t scale, and generic outreach lacks the context that makes email worth opening. Thrad.ai’s sales team spent 30 to 45 minutes researching each lead across six sources before writing one outreach email.
A single AI agent can’t solve this: the signal diversity is too broad, the source APIs too varied, and the analysis too nuanced for one model to handle well. With multi-agent orchestration, you assign each source to a specialist agent, then fuse results through a dedicated analysis agent that spots cross-source patterns.
This post shows how Thrad.ai deployed a multi-agent system with Strands Agents and Amazon Bedrock AgentCore that automates the pipeline from prospect discovery through personalized email generation. The post compares two orchestration patterns (Swarm and Graph) with head-to-head benchmarks on latency, cost, and email quality. You’ll also learn how the system scores prospects using weighted criteria, intent classification, and temporal decay, plus governance controls for production deployment.
You can apply these patterns to competitive intelligence, candidate sourcing, and market research. A companion repository is available to help you follow along.
Prerequisites
This post assumes familiarity with Python, AWS Cloud Development Kit (AWS CDK) basics, and large language model (LLM) concepts.
- AWS account with Amazon Bedrock access (Claude Sonnet 4.6 model enabled) and Amazon Bedrock AgentCore.
- Permissions for Amazon DynamoDB, AWS Lambda, AWS Secrets Manager, and AWS CDK.
- Python 3.12+, Node.js 18+
- strands-agents>=1.25.0, bedrock-agentcore[strands-agents]>=1.2.1, pydantic>=2.12.5
- Approximately 60 minutes for hands-on deployment, approximately $3 to $5 (Amazon Bedrock model invocations).
- Important: Deployed resources (DynamoDB tables, Lambda functions, AgentCore services) incur charges while running. Complete the Clean up steps after finishing the tutorial to avoid ongoing costs.
Note: You can follow this post conceptually without deploying. To run the code yourself, you’ll need the preceding prerequisites.
# Clone the companion repository
git clone https://github.com/aws-samples/sample-multi-agent-social-intelligence-strands-agentcore
cd sample-multi-agent-social-intelligence-strands-agentcore
# Install dependencies with uv
uv sync
# Deploy infrastructure
cd infra && cdk deploy --allFull setup guide: README.md
Solution overview
With this architecture illustrated in Figure 1, you can turn raw social signals into personalized outreach automatically. Four specialized agents handle discovery, enrichment, scoring, and email generation, each with its own tools and strict output validation.

Four-agent pipeline with Amazon Bedrock AgentCore Runtime, Gateway, Memory, and Observability
The following table describes each agent’s role, tools, and the AgentCore services it uses.
Agent
Role
Tools
AgentCore Services
Trend Research
Discovers trending launches and buying-intent signals
Hacker News, YouTube, dev.to, ProductHunt, Reddit, Stack Overflow APIs
Runtime, Gateway
Search Specialist
Enriches prospect profiles with context
Wikipedia, GitHub, Lobste.rs, Stack Overflow APIs
Runtime, Gateway
Analysis
Scores prospect-trend pairs (0-100)
Scoring engine, ICP matcher
Runtime, Memory
Email Generation
Drafts personalized outreach
Brand knowledge retrieval, lead storage
Runtime, Gateway, Memory
Two agents start data collection in parallel. The Trend Research Agent queries six sources (Hacker News, YouTube, dev.to, ProductHunt, Reddit, Stack Overflow) for trending launches and buying-intent signals. Meanwhile, the Search Specialist Agent enriches each prospect via Wikipedia, GitHub, Lobste.rs, and Stack Overflow.
After both agents finish, the Analysis Agent scores each prospect-trend pair from 0 to 100 using Claude Sonnet 4.6 on Amazon Bedrock. The agents use a global inference profile (global.anthropic.claude-sonnet-4-6), which routes requests to the nearest available Region. This avoids region-specific model ARNs in IAM policies and streamlines multi-Region deployment. High-scoring prospects flow to the Email Generation Agent, which drafts personalized email messages tied to specific trends and validates each draft against brand guidelines.
Each agent owns one responsibility, one set of tools, and one Pydantic-validated output contract. Pydantic is a Python data validation library that enforces type-safe schemas at runtime. If an agent returns data in the wrong shape, the system catches it before the next agent sees it.
The Reddit tool scans five subreddits (r/SaaS, r/startups, r/devtools, r/selfhosted, r/Entrepreneur) and uses keyword pattern matching to classify posts into four intent categories: recommendation-seeking, competitor frustration, product launch, and purchase intent. When a Hacker News launch also appears in a Reddit “what tool should I use?” thread, that prospect scores higher.
The scoring relies on signal triangulation: a prospect needs correlated evidence from at least two independent sources. The Trend Research Agent first calls check_existing_leads to skip prospects already in the pipeline. A trending Hacker News post with no Reddit discussion, no Stack Overflow activity, and zero GitHub stars likely reflects a promotional push. The system filters it before spending tokens on analysis.
The Analysis Agent applies five weighted criteria: topical alignment (25%), timing relevance (20%), engagement potential (20%), intent signals (20%), and data quality (15%). Ideal customer profile (ICP) matching adds up to 10 bonus points for developer tools with open source presence and B2B focus. Temporal decay sharpens the score: signals under 24 hours old get 1.5x weight, signals over 7 days get 0.5x.
Strands orchestration: Swarm vs. Graph
Now comes the central design decision: how do four agents coordinate? Strands Agents provides two orchestration patterns. Thrad.ai built both and compared them against the same 50-prospect workload. The following sections walk through each pattern, then present benchmark results.
Swarm: Autonomous handoffs
Figure 2 illustrates how agents are passing control via the handoff_to_agent tool with shared context. In Swarm orchestration, agents pass control dynamically using a handoff_to_agent tool. The Trend Research Agent discovers prospects and hands off to Search Specialist for enrichment. Search Specialist passes to Analysis for scoring. If data is sparse, Analysis can hand back to Trend Research for additional context. Agents share a common working memory.

Dynamic agent-to-agent transfers with shared working memory
Swarm agents act as self-organizing peers with shared context, where each agent decides when to hand off to a specialist. Trend Research discovers a prospect and hands off to Search Specialist for enrichment, and Search Specialist passes to Analysis for scoring.
If data is thin, Analysis hands *back* to Trend Research to receive more context. This bidirectional handoff lets agents request additional context when needed.
The following code shows how to configure a Swarm with safety bounds:
swarm = Swarm(
agents=[trend_agent, search_agent, analysis_agent, email_agent],
entry_point=trend_agent,
max_handoffs=15,
execution_timeout=1200.0,
repetitive_handoff_detection_window=8,
repetitive_handoff_min_unique_agents=3,
)The repetitive handoff parameters matter. Without them, two agents can ping-pong across each other indefinitely. A window of 8 with a minimum of 3 unique agents forces forward progress.
Swarm works best when prospect complexity varies and agents benefit from re-engaging earlier stages. However, execution paths are harder to predict, and token consumption runs higher from handoff-reasoning overhead.
Graph: Structured workflow
Figure 3 illustrates how a directed graph starts with parallel research and search entry points, then converges at analysis, with a conditional edge to email. In Graph orchestration, agents follow a fixed directed workflow. Trend Research and Search Specialist run in parallel as entry points. Analysis waits for both to finish before running. A conditional edge gates Email Generation, which only runs if the prospect scores 60 or higher.

Parallel entry, all-dependencies-complete gating, and conditional score threshold
The Graph pattern wires agents into a fixed workflow with explicit, one-way edges. Trend Research and Search Specialist run in parallel, cutting data-gathering time in half. Analysis waits for both to finish. Email runs only if the prospect scores 60 or higher, acting as a policy gate.
The following code shows how to define a Graph with parallel entry points and conditional edges:
builder = GraphBuilder()
builder.add_node(trend_agent, "research")
builder.add_node(search_agent, "search")
builder.add_node(analysis_agent, "analysis")
builder.add_node(email_agent, "email")
builder.set_entry_point("research")
builder.set_entry_point("search")
wait_for_both = _all_dependencies_complete(["research", "search"])
builder.add_edge("research", "analysis", condition=wait_for_both)
builder.add_edge("search", "analysis", condition=wait_for_both)
builder.add_edge("analysis", "email", condition=_score_above_threshold)Graph shines when the workflow is repeatable and auditability matters. Every run follows the same path, so you can reproduce failures by replaying the same input. The limitation is that it can’t dynamically loop back without explicit feedback edges. If an agent needs more context, you’ll need to add a dedicated feedback edge in the directed acyclic graph (DAG) definition.
Head-to-head results
Both patterns ran three times against 50 Hacker News prospects. Two reviewers scored email relevance on a 1 to 10 rubric (specificity, tone, accuracy).
Metric
Swarm
Graph
Avg latency per prospect
45s
32s
P95 latency
78s
38s
Avg tokens per prospect
~12,000
~8,500
Email relevance (human-rated)
8.2
7.6
Cost per prospect (est.)
~$0.08
~$0.06
Business impact: For a 1,000-prospect batch, Graph saves approximately 3.6 hours of processing time and $20 in token costs compared to Swarm.
Swarm produced higher-quality email messages (8.2 vs. 7.6) because agents looped back for more context when data was sparse, while Graph cost 25% less per prospect with tighter latency bounds. Thrad.ai chose Graph for nightly batch processing and Swarm for weekly deep-dives on high-value prospects.
How to decide: Choose Graph when the workflow is repeatable and you need predictable latency. Choose Swarm when input quality varies and agents need to adapt. You can run both in the same code base, switched by a configuration flag.
Deploying on Amazon Bedrock AgentCore
Production workloads need session isolation, capacity management, and observability that go beyond local prototyping. Amazon Bedrock AgentCore handles these as managed services. The CDK stack (client-side orchestration code that defines your infrastructure) deploys four services using aws-cdk-lib/aws-bedrock-agentcore-alpha L2 constructs:
- Runtime hosts agents in isolated microVMs (lightweight virtual machines) with AWS Identity and Access Management (IAM) authentication and lifecycle controls (15-min idle timeout, 8-hour max lifetime).
- Gateway provides a single Model Context Protocol (MCP) endpoint for the nine tools. MCP is a standard protocol for LLM-tool communication. Agents discover tools dynamically at startup via the Strands MCPClient.
- Memory stores short-term context within sessions and long-term semantic data across sessions. Optional; agents degrade gracefully without it.
- Observability captures distributed traces via OpenTelemetry (an open standard for telemetry data) with span-level latency and token counts. Integrates with Amazon CloudWatch and third-party services.
Thrad.ai found that YouTube API calls accounted for 40% of total latency. The trace data led the team to add get_with_retry with exponential backoff to HTTP calls.
The companion README for this blog post and AgentCore documentation provides the full CDK stack, Gateway setup, and deployment walkthrough.
Walkthrough: A real run
Here’s what a Graph run produces against the current Hacker News feed:
[Graph] Starting nodes: research, search (parallel)
[research] 12 trending HN posts + 4 Reddit intent signals, filtered to 3 AI launches
[search] Enriched 3 prospects: GitHub stars, Wikipedia context, Lobste.rs discussions
[Graph] All dependencies complete → starting: analysis
[analysis] Scored 3 prospects:
- Prospect A (AI code review tool): 88/100, intent: recommendation_seeking
- Prospect B (ML monitoring dashboard): 61/100, no intent signal
- Prospect C (LLM fine-tuning CLI): 45/100, below threshold, skipped
[Graph] Conditional edge: score >= 60 → starting: email (Prospects A, B)
[email] Generated 2 personalized emails, persisted to DynamoDBHere’s an example email generated for Prospect A:
Subject: Saw your AI code review launch trending on HN
Hi [Name],
Congrats on crossing 2,400 stars on GitHub this week—impressive
traction for an AI code review tool. I noticed the r/SaaS thread
where developers are asking for alternatives to [Competitor]; your
approach to contextual suggestions seems to address exactly what
they're frustrated about.
We're building Thrad for teams scaling developer outreach. Our
customers use it to turn signals like yours into qualified
conversations. Would love 15 minutes to share how similar
dev-tool founders shortened their sales cycle.
Best,
[Sender]Prospect A scored 88 because of cross-source signals (HN + Reddit + dev.to), 2,400 GitHub stars matching ICP criteria, and all signals under 48 hours old (1.5x temporal weight). Prospect C scored below 60 and was skipped, saving ~3,000 tokens. The Graph pattern processed all 50 prospe
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み