Building AI and LLM Applications with LangChain and LangGraph
Mayo Oshin and Nuno Campos

#LangChain
#LangGraph
#AI
#LLM
#RAG
#JavaScript
#Python
🤖 اگر بهدنبال ساخت برنامههای هوش مصنوعی آمادهی اجرا در محیط واقعی هستید — برنامههایی که بتوانند استدلال کنند و دادههای بیرونی را برای درک متنی و زمینهای بازیابی کنند — لازم است بر LangChain مسلط شوید؛ چارچوب و پلتفرمی محبوب برای توسعه، اجرا و مدیریت برنامههای عاملمحور (Agentic Applications). شرکتهای بزرگی مانند Zapier، Replit، Databricks و بسیاری دیگر از LangChain استفاده میکنند.
این راهنما منبعی ضروری برای توسعهدهندگانی است که پایتون یا جاوااسکریپت میدانند، اما تازه میخواهند از قدرت واقعی هوش مصنوعی بهره ببرند.
نویسندگان، میو اوشین (Mayo Oshin) و نونو کامپوس (Nuno Campos)، استفاده از LangChain را با آموزشهای عمیق و بینشهای عملی سادهسازی کردهاند. این کتاب از مفاهیم پایه آغاز میکند و گامبهگام به شما میآموزد چگونه یک عامل هوش مصنوعی بسازید که بتواند با دادههای اختصاصی شما کار کند.
با مطالعهی این کتاب، شما خواهید آموخت:
هدف ما از نگارش این کتاب، انتقال هیجان و فرصتهای بیپایانی است که افزودن مدلهای زبانی بزرگ (LLMs) به جعبهابزار مهندسی نرمافزار شما به همراه میآورد.
ما وارد دنیای برنامهنویسی شدیم چون عاشق ساختن چیزهای جدید هستیم — این حس که در پایان پروژهای بایستی و به اثری نگاه کنی که پیشتر وجود نداشت. برنامهنویسی با LLMها این شور را چندبرابر میکند، چون کارهایی را ممکن میسازد که قبلاً دشوار یا غیرممکن بودند.
بهعنوان نمونه، گرفتن اعداد مهم از متنی طولانی یا ساخت یک دستیار خودکار تا همین چند سال پیش غیرقابل تصور بود.
اما اکنون با LLMها و LangChain میتوانید دستیارهایی بسازید که لذتبخش، قابلدرک و زمینهمحور باشند. تفاوت میان گذشته و امروز، بهراستی مانند شب و روز است!
در پیشگفتار، توضیح خواهیم داد که چه چیزی باعث میشود LLMها اینقدر قدرتمند باشند و چرا آنها به شما «ابرقدرت ساخت چیزها» میدهند. این مدلهای عظیم زبانی، با درک زبان طبیعی و تولید پاسخهای محاورهای، به ابزاری قابلبرنامهریزی از طریق مهندسی پرامپت (Prompt Engineering) تبدیل میشوند.
در آغاز، یک چتبات هوش مصنوعی خواهیم ساخت که با دستورهای سادهی انگلیسی قابل تنظیم است — تجربهای که نشان میدهد دیگر لازم نیست برای بخشهایی از رفتار نرمافزار، مستقیماً کدنویسی کنید.
سپس قابلیتهای جدیدی به آن میافزاییم:
در طول مسیر، تمام این مفاهیم را بهصورت فنی و کاربردی آموزش میدهیم تا در پایان کتاب، شما واقعاً ابزار تازهای به کمربند مهندسی نرمافزار خود افزوده باشید.
میو اوشین (Mayo Oshin) کارآفرین فناوری، مشاور هوش مصنوعی و سرمایهگذار فرشته است. او در زمینهی ساخت برنامههای هوش مصنوعی مبتنی بر دادههای خصوصی تخصص دارد و از توسعهدهندگان اولیهی LangChain و از پیشگامان جنبش «چت با دادهها» محسوب میشود (با بیش از ۵ میلیون مخاطب ایدههایش در حوزهی AI).
او با مهندسان و مدیران محصول در شرکتهای بزرگی چون Amazon، LinkedIn، Evercore، Visa و BCG همکاری آموزشی و مشاورهای داشته است.
🔗 وبسایت: mayooshin.com
📱 شبکه X: @mayowaoshin
نونو کامپوس (Nuno Campos) مهندس نرمافزار ارشد و از اعضای بنیانگذار شرکت LangChain Inc. است. او بیش از ده سال تجربه در زمینهی مهندسی نرمافزار با Python و JavaScript، معماری سیستمها و نگهداری پروژههای متنباز دارد.
وی پیشتر در چندین استارتاپ فناوری در حوزههای مهندسی نرمافزار و علم داده فعالیت کرده و دارای کارشناسی ارشد در رشتهی مالی (MSc in Finance) است.
If you're looking to build production-ready AI applications that can reason and retrieve external data for context-awareness, you'll need to master--;a popular development framework and platform for building, running, and managing agentic applications. LangChain is used by several leading companies, including Zapier, Replit, Databricks, and many more. This guide is an indispensable resource for developers who understand Python or JavaScript but are beginners eager to harness the power of AI.
Authors Mayo Oshin and Nuno Campos demystify the use of LangChain through practical insights and in-depth tutorials. Starting with basic concepts, this book shows you step-by-step how to build a production-ready AI agent that uses your data.
Table of Contents
Chapter 1. LLM Fundamentals with LangChain
Chapter 2. RAG Part I: Indexing Your Data
Chapter 3. RAG Part II: Chatting with Your Data
Chapter 4. Using LangGraph to Add Memory to Your Chatbot
Chapter 5. Cognitive Architectures with LangGraph
Chapter 6. Agent Architecture
Chapter 7. Agents II
Chapter 8. Patterns to Make the Most of LLMs
Chapter 9. Deployment: Launching Your AI Application into Production
Chapter 10. Testing: Evaluation, Monitoring, and Continuous Improvement
Chapter 11. Building with LLMs
With this book, we hope to convey the excitement and possibility of adding LLMs to your software engineering toolbelt.
We got into programming because we like building things, getting to the end of a project, looking at the final product and realizing there’s something new out there, and we built it. Programming with LLMs is so exciting to us because it expands the set of things we can build, it makes previously hard things easy (for example, extracting relevant numbers from a long text) and previously impossible things possible—try building an automated assistant a year ago and you end up with the phone tree hell we all know and love from calling up client service numbers.
Now with LLMs and LangChain, you can actually build pleasant assistants (or myriad other applications) that chat with you and understand your intent to a very reasonable degree. The difference is night and day! If that sounds exciting to you (as it does to us) then you’ve come to the right place.
In the Preface, we'll give you a refresher on what makes LLMs tick and why exactly that gives you “thing-building” superpowers. Having these very large ML models that understand language and can output answers written in conversational English (or some other language) gives you a programmable (through prompt engineering), versatile language-generation tool. By the end of the book, we hope you’ll see just how powerful that can be.
We’ll begin with an AI chatbot customized by, for the most part, plain English instructions. That alone should be an eye-opener: you can now “program” part of the behavior of your application without code.
Then comes the next capability: giving your chatbot access to your own documents, which takes it from a generic assistant to one that’s knowledgeable about any area of human knowledge for which you can find a library of written text. This will allow you to have the chatbot answer questions or summarize documents you wrote, for instance.
After that, we’ll make the chatbot remember your previous conversations. This will improve it in two ways: It will feel a lot more natural to have a conversation with a chatbot that remembers what you have previously chatted about, and over time the chatbot can be personalized to the preferences of each of its users individually.
Next, we’ll use chain-of-thought and tool-calling techniques to give the chatbot the ability to plan and act on those plans, iteratively. This will enable it to work toward more complicated requests, such as writing a research report about a subject of your choice.
As you use your chatbot for more complicated tasks, you’ll feel the need to give it the tools to collaborate with you. This encompasses both giving you the ability to interrupt or authorize actions before they are taken, as well as providing the chatbot with the ability to ask for more information or clarification before acting.
Finally, we’ll show you how to deploy your chatbot to production and discuss what you need to consider before and after taking that step, including latency, reliability, and security. Then we’ll show you how to monitor your chatbot in production and continue to improve it as it is used.
Along the way, we’ll teach you the ins and outs of each of these techniques, so that when you finish the book, you will have truly added a new tool (or two) to your software engineering toolbelt.
About the Author
Mayo Oshin is a tech entrepreneur, AI advisor and angel investor, specializing in AI apps trained on private data. Mayo was an early developer contributor and advocate for the open source LangChain library and an early pioneer in the popular AI 'chat' with data movement (5+ million people reached through his thought-leadership ideas so far).
Mayo has consulted with, advised, and trained hundreds of engineers and product managers at various leading institutions, including Amazon, LinkedIn, Evercore, Visa, and BCG.
You can learn more about him at his website, mayooshin.com, and get his latest ideas on AI and technology on X (https://x.com/mayowaoshin).
Nuno Campos is a founding software engineer at LangChain, Inc. Nuno has a decade of experience as a Python and JavaScript software engineer, architect and open-source maintainer. He has worked for various tech startups in software engineering and data science roles. He holds an MSc in Finance.









