🌐 فراتر از مرزها؛ مسیر بین‌المللی CardDev

From RAG to AI Agents

Chapters
19 Flashcards
6 Gallery cards
44 Audio
19 Prompts
19 Glossary

Imagine a software assistant that doesn't just follow commands, but understands your goals and proactively takes steps to achieve them. This chapter dives into the exciting world of AI Agents, moving beyond simple RAG (Retrieval-Augmented Generation) to systems that can reason, plan, and act autonomously. The core challenge AI agents address is bridging the gap between understanding natural language requests and executing complex, multi-step tasks. Without agents, AI models are powerful but passive; they can generate text or answer questions based on provided context, but they can't do things in the real world or even in the digital realm beyond their immediate output. This chapter illuminates how agents overcome this limitation, enabling AI to become a true collaborator and problem-solver. At its heart, an AI Agent is a system designed to perceive its environment, make decisions, and take actions to achieve specific goals. Think of it like a highly skilled intern who, given a broad objective like "prepare a market analysis report," can independently decide to search the web for data, consult internal documents, synthesize findings, and even draft the report. The Agentic Stack provides the foundation for this, typically comprising a Large Language Model (LLM) for reasoning, an orchestration layer to manage the agent's workflow, and tools (like APIs or functions) that the agent can use to interact with the world. This contrasts with earlier AI, which relied on brittle, hand-coded rules. We'll explore the difference between Single-Agent Systems, where one agent handles a task, and Multi-Agent Systems, where multiple agents collaborate, each with specialized skills, to tackle more complex problems. This collaboration can take a supervisor architecture, where one agent delegates tasks, or a collaborative architecture, where agents interact peer-to-peer, offering more flexibility but also introducing complexity. Agentic Use Cases span numerous domains. In Customer Service, agents can handle complex queries, manage escalations, and personalize interactions beyond simple FAQs. Financial Services can leverage agents for tasks like fraud detection, personalized investment advice, and automated report generation. Healthcare sees agents assisting with patient intake, summarizing medical literature, and even aiding in diagnostics. Even AI Coding Agents are emerging, capable of writing, debugging, and optimizing code. The fundamental mechanism driving these agents is the Agentic Loop, a cycle of Reasoning, Acting (often through Tool Calling), and Observing the results to refine the next step. This loop is powered by the Model Context Protocol (MCP), which defines how agents communicate with models and tools, ensuring efficient and structured interaction, especially crucial in Enterprise Agentic AI for managing sensitive data and workflows. Agent-to-Agent Communication protocols, like the Agent Card system, standardize how these autonomous entities find and interact with each other, enabling sophisticated teamwork. We'll get hands-on with Agentic AI Frameworks like LangChain for building AI Chatbots, LlamaIndex for Document Generation Agents, Vectara for specialized agentic applications, and CrewAI for orchestrating Multi-Agent Systems. A critical aspect is Agentic Memory, distinguishing between Short-Term Memory (immediate context) and Long-Term Memory (persistent knowledge), often implemented using Agentic RAG. For enterprise deployment, Enterprise Guardrails are paramount, ensuring Privacy and Integrity of data and operations. Finally, Evaluation and Observability are key to understanding and debugging these complex systems, covering Agentic Observability, Tracing an Agent, and key Observability Metrics using specialized Tools for Agentic Observability. Key trade-offs emerge when building agentic systems. The power of multi-agent systems comes with a "complexity tax": increased latency, higher costs, and the challenge of debugging distributed interactions. Balancing the capabilities of sophisticated LLMs with the need for deterministic tool execution is another tension. Furthermore, ensuring robust security and privacy while enabling agents to access and process information requires careful design of guardrails and communication protocols. By the end of this chapter, you'll be equipped to: [ ] Define the core components and purpose of an AI agent. [ ] Differentiate between single-agent and multi-agent system architectures. [ ] Identify key use cases for AI agents across various industries. [ ] Explain the agentic loop and the role of tool calling. [ ] Understand the principles of agent memory and its implementation. [ ] Recognize the importance of enterprise guardrails and observability. [ ] Select and utilize appropriate frameworks for building agentic applications.

Chapter

1

Cover of Hands-On RAG for Production
O’Reilly

Chapter 7 of Hands-On RAG for Production: From RAG to AI Agents

Book release

Published

Chapter 7 progress
Book progress

Reading time

00:00

Gallery

Yes

Audio status

Preview

Analysis

AI