Skip to main content

Posts

Project: Smart Inventory Agent

The Smart Inventory Agent pulls together everything covered in this series, LangChain agents, structured data, tool use, email automation, and guardrails, into one autonomous system that monitors stock levels, detects low-inventory items, searches for suppliers, and sends professional email summaries without human oversight. Purpose Traditional inventory management often relies on manual audits or disconnected systems that require constant oversight. The Smart Inventory Agent replaces that with a fully automated workflow that reads inventory data from a SQLite database, identifies products below their threshold levels, searches the web for suppliers, generates professional HTML email reports, logs every action for auditability, and supports natural-language interaction through a chat interface. System Architecture LangChain Agent : a ReAct-style agent powered by GPT-4o-mini executes reasoning steps and calls tools for database access, web search, email sending, and logging, wit...

Agent Evaluation, Observability, and Guardrails

Building an agent is only half the job. This module covers testing agent behavior before deployment, tracing and debugging what an agent actually did in production, and putting guardrails in place so autonomous agents stay safe, cost-effective, and within scope. Why Agents Are Hard to Test the Normal Way A traditional function returns the same output for the same input every time, so a unit test asserting exact equality works fine. An LLM-powered agent doesn't behave that way: the same input can produce differently-worded but equally correct outputs, and a small prompt tweak can silently break a workflow three steps downstream. Agent testing needs a representative dataset of realistic inputs, not just the happy path, and evaluators that judge correctness by criteria rather than exact string matching. A good evaluation dataset covers the happy path, edge cases, adversarial inputs designed to make the agent misbehave, and every past production failure, since any real bug should...

Claude Desktop and Claude Code as AI Agents

Everything covered so far, tools, memory, control loops, MCP, shows up in products you can open right now. Claude Desktop and Claude Code are two everyday interfaces built on exactly the same agentic patterns as the systems built earlier in this series. Claude Desktop as an Agent Interface Claude Desktop's interface covers everything from basic communication to advanced workflow organization: Basic interaction : writing and refining professional emails or other text through follow-up prompts, the way a conversational agent iterates on a task Data summarization : uploading documents, PDFs, or spreadsheets to generate summaries and key takeaways, a lightweight form of the retrieval and grounding covered in the RAG module Artifacts : a dedicated workspace for creating, editing, and refining documents, templates, or code, rather than pasting everything back and forth in chat Projects : grouping specific files, artifacts, and instructions into a shared space to maintain organi...

Model Context Protocol (MCP)

Module 6 of the Agent Loop series (see Module 5: Retrieval-Augmented Generation (RAG) ). The Model Context Protocol, or MCP, is an open-source standard that defines how AI applications connect to external systems such as tools, data sources, and workflows. Instead of every AI app inventing its own custom integration layer, MCP provides a shared protocol, so the same server can be used by multiple AI clients and integrations become portable, easier to build, and easier to maintain. Why MCP Exists Large language models are powerful but limited in isolation: they cannot directly access live data, cannot safely call external tools on their own, and every app tends to build its own ad hoc integration layer. MCP addresses this by defining a standard message format for requests and responses, providing a consistent way to describe tools, resources, and prompts, and enabling secure, permissioned access to external systems. Think of it as a universal connector between AI models and the out...

Retrieval-Augmented Generation (RAG)

Retrieval-Augmented Generation, or RAG, enhances large language models by combining generation with information retrieval. Instead of relying only on the model's internal parameters, RAG retrieves relevant documents from external sources and injects them into the reasoning process, addressing outdated knowledge, hallucinated responses, and lack of specificity. The RAG Workflow Receive user query , natural language input enters the system Retrieve relevant documents , a similarity search over a vector store returns the top-matching chunks Construct a prompt , the retrieved text is injected into a prompt template Generate a response , the augmented prompt is sent to the LLM for a grounded output Why RAG Improved factual accuracy : retrieved documents supply verifiable information Reduced hallucination : responses are constrained by retrieved content Scalability : the document store can be updated without retraining the model Personalization : custom collections, such...

Data Connectivity and Email Services

This module bridges reasoning and the real world: connecting an agent to a structured database so it can query live data, and giving it the ability to send email, so it can report findings, summaries, and alerts without a human copying and pasting results. Why SQLite for Agentic Systems SQLite is a lightweight, serverless SQL engine that needs no external configuration, which makes it ideal for prototyping AI agents that need to reason over structured data. Before an LLM can query a database usefully, it needs the schema in a text form it can read, which means extracting table names and column definitions: cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") tables = cursor.fetchall() cursor.execute("PRAGMA table_info(users);") columns = cursor.fetchall() These two queries form the foundation of a reusable schema-inspection tool the agent can call before it writes any SQL. Natural Language to SQL with GPT Converting a natural langu...

Task Flow with LangGraph

LangGraph introduces graph-based orchestration, where nodes represent functional or decision units and edges dictate flow based on outcomes or state, so workflows that need conditional logic, retries, or approval checkpoints don't have to be forced into a single straight-line chain. Learning Objectives Understand how LangGraph differs from linear LangChain workflows Design AI workflows using nodes, edges, and shared state Define reusable reasoning flows through graph modeling Build and test a basic LangGraph with conditional transitions From Chains to Graphs: A New Control Paradigm LangChain's chains and agent loops are powerful, but a single linear structure becomes limiting once a workflow needs conditional logic, retries, user approval, or fallback paths. LangGraph solves this with graph-based orchestration: nodes are callable units (an LLM chain, a tool call, a logic step), and edges define transitions between them, including branching based on outcomes. This ...