Skip to Content
生成AIデザインパターン
book

生成AIデザインパターン

by Valliappa Lakshmanan, Hannes Hapke
October 2025
Beginner to intermediate
508 pages
8h 1m
Japanese
O'Reilly Media, Inc.
Content preview from 生成AIデザインパターン

第10章. コンポーザブルエージェントワークフロー

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

この章では、最初の9章から までのパターンをアプリケーションにまとめ、パターンがどのように相互作用し、時間が経つにつれて良くなっていく、本番に耐えうるエージェントアプリケーションを構築できるようになるかを示す。

この章の完全なコードは、本書のGitHub リポジトリで発見できる。お好きなPython IDEでコードを開き、私たちと一緒にフォローしてほしい。

エージェントのワークフロー

この章では、完全なアプリケーションを構築するのではなく、顧客のユースケースに対応するアプリケーションの垂直スライスを示す。GenAIでは、このような垂直スライスは、AIアシストや完全自動化のプロセスにあるユーザ主導(手動)のワークフローに対応することが多い。AIアシスタントはコパイロットと呼ばれ、自律型AIはエージェントと呼ばれる。このスペクトル上のアプリケーションはすべてエージェントと呼ばれる。したがって、GitHubリポジトリでデモしているのは、エージェント型ワークフローだ。

このワークフローは教育コンテンツの作成を意図している。パターン23「マルチエージェントコラボレーション」の説明で探ったのと同じユースケースだ。これは図10-1に描かれている。図7-5とは異なり、レビューのステージが2つあり(1つだけではない)、転送されるデータが描かれていることに注意されたい。また、コンテンツ執筆チームには、本書の内容に基づいてGenAIのトピックについて執筆するライターを含め、さらに数名のライターがいる。

Diagram illustrating the workflow for creating educational content, showing a content writing team and two stages of review, including roles of writers and reviewers.
図10-1. 教育コンテンツ作成のエンドツーエンドの例におけるエージェント間のコラボレーション

パターン23とは異なり、ここではマルチエージェントフレームワークを使わずにワークフローを構築する。効果的なエージェントの構築に関するAnthropicの影響力のある記事は、「最も成功した実装は、複雑なフレームワークではなく、シンプルで構成可能なパターンを使っている」と指摘しており、これはUnixの哲学を彷彿とさせる。さて、本書で一連の構成可能なパターンを探ったので、それらを使って、LLMにもクラウドにもとらわれない方法で、効果的なマルチエージェント、マルチステップワークフローを構築してみよう。

アプリケーションを実行する

、AIアシスタント(コパイロット)として実行する方法と、完全に自律型アプリケーション(エージェント)として実行する方法がある。 アプリケーションの実行方法に関わらず、どちらも同じセットアップが必要だ。

セットアップ

仮想環境(サイドバー参照)で、必要な依存関係をインストールする:

python -m pip install -r requirements.txt

次に、keys.envファイルを編集し、Gemini APIキーを追加する。Gemini APIキーを持っていない場合は、GoogleのAI Studioから取得できる。

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

はじめての知識グラフ構築ガイド

はじめての知識グラフ構築ガイド

Jesus Barrasa, Jim Webber
AIネイティブのソフトウェアデリバリー

AIネイティブのソフトウェアデリバリー

Nick Durkin, Eric Minick, Chinmay Gaikwad

Publisher Resources

ISBN: 9798341671447