Skip to Content
初めてのLangChain ―LangChainとLangGraphによるAI/LLMアプリケーションの構築
book

初めてのLangChain ―LangChainとLangGraphによるAI/LLMアプリケーションの構築

by Mayo Oshin, Nuno Campos, 新井 翔太, 嶋田 健志
September 2025
Intermediate to advanced
296 pages
4h 30m
Japanese
O'Reilly Japan, Inc.
Content preview from 初めてのLangChain ―LangChainとLangGraphによるAI/LLMアプリケーションの構築

7章エージェントアーキテクチャの拡張

6章ではエージェントアーキテクチャを紹介した。これは、これまで見てきた中で最も強力なLLMアーキテクチャと言える。CoT、ツールの活用、そしてループを組み合わせた仕組みであり、そのポテンシャルは非常に高い。

エージェントアーキテクチャは、特定の用途において性能を向上するように拡張できる。

リフレクション
LLMアプリケーションに過去の出力や意思決定を振り返り分析させ、以前の経験を記憶し内省させることで、それらを次の出力に反映させる仕組み。
マルチエージェント
1つのエージェントだけでは解決しにくい複雑な問題や規模の大きな問題に対し、複数のエージェントを連携させることで問題を解決する能力を高める仕組み。

本章ではこれらの方法について説明する。

7.1 リフレクションアーキテクチャ

リフレクションとは、生成のためのプロンプトと、それを修正したり振り返りを行うためのプロンプトを、交互に繰り返すループを作る方法だ†1。これは人間が創作する多くの成果物の生成プロセスを模している。例えば本章の文章は、著者、査読者、編集者の間で何度もやり取りを繰り返し、最終的な形に仕上げられたものだ。リフレクションは、このようなやり取りの仕組みを模倣している。

リフレクションも、他のプロンプトのテクニックと同様に、CoTやツール呼び出しなど、他のテクニックと組み合わせることができる。ただし本節では、リフレクションを単独で扱う。

人間の思考のうち、反応的または本能的なものをシステム1、理性を持ち内省的なものをシステム2と捉えることができる†2。自己批評を正しく適用することで、LLMアプリケーションをシステム2のような振る舞いに近づけることができる(図7-1)。

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

プラットフォームエンジニアリング ―成功するプラットフォームとチームを作るガイドライン

プラットフォームエンジニアリング ―成功するプラットフォームとチームを作るガイドライン

Camille Fournier, Ian Nowland, 松浦 隼人
レガシーコードからの脱却 ―ソフトウェアの寿命を延ばし価値を高める9つのプラクティス

レガシーコードからの脱却 ―ソフトウェアの寿命を延ばし価値を高める9つのプラクティス

David Scott Bernstein, 吉羽 龍太郎, 永瀬 美穂, 原田 騎郎, 有野 雅士

Publisher Resources

ISBN: 9784814401307Publisher Website