Category
python
34 articles across 15 sub-topics
RAG vs Fine-Tuning: When to Use Each (and When to Combine Them)
TLDR: RAG gives LLMs access to current knowledge at inference time; fine-tuning changes how they reason and write. Use RAG when your data changes. Use fine-tuning when you need consistent style, tone, or domain reasoning. Use both for production assi...
Build vs Buy: Deploying Your Own LLM vs Using ChatGPT, Gemini, and Claude APIs
TLDR: Use the API until you hit $10K/month or a hard data privacy requirement. Then add a semantic cache. Then evaluate hybrid routing. Self-hosting full model serving is only cost-effective at > 50M tokens/day with a dedicated MLOps team. The build ...
LangChain Tools and Agents: The Classic Agent Loop
šÆ Quick TLDR: The Classic Agent Loop TLDR: LangChain's @tool decorator plus AgentExecutor give you a working tool-calling agent in about 30 lines of Python. The ReAct loop ā Thought ā Action ā Observation ā drives every reasoning step. For simple l...

LangChain 101: Chains, Prompts, and LLM Integration
TLDR: LangChain's LCEL pipe operator (|) wires prompts, models, and output parsers into composable chains ā swap OpenAI for Anthropic or Ollama by changing one line without touching the rest of your code. š One LLM API Today, Rewrite Tomorrow: The...
From LangChain to LangGraph: When Agents Need State Machines
TLDR: LangChain's AgentExecutor is a solid starting point ā but it has five hard limits (no branching, no pause/resume, no parallelism, no human-in-the-loop, no crash recovery). LangGraph replaces the implicit loop with an explicit graph, unlocking e...

LangGraph Tool Calling: ToolNode, Parallel Tools, and Custom Tools
TLDR: Wire @tool, ToolNode, and bind_tools into LangGraph for agents that call APIs at runtime. š The Stale Knowledge Problem: Why LLMs Need Runtime Tools Your agent confidently tells you the current stock price of NVIDIA. It's from its training d...
Streaming Agent Responses in LangGraph: Tokens, Events, and Real-Time UI Integration
TLDR: Stream agents token by token with astream_events; wire to FastAPI SSE for zero-spinner UX. š The 25-Second Spinner: Why Streaming Is a UX Requirement, Not a Nice-to-Have Your agent takes 25 seconds to respond. Users abandon after 8 seconds....
The ReAct Agent Pattern in LangGraph: Think, Act, Observe, Repeat
TLDR: ReAct = Think + Act + Observe, looped as a LangGraph graph ā prebuilt or custom. š The Single-Shot Failure: Why One LLM Call Isn't Enough for Complex Tasks Your agent is supposed to write a function, run the tests, fix the failures, and re...
Multi-Agent Systems in LangGraph: Supervisor Pattern, Handoffs, and Agent Networks
TLDR: Split work across specialist agents ā supervisor routing beats one overloaded generalist every time. š The Context Ceiling: Why One Agent Can't Do Everything Your research agent is writing a 20-page report. It has 15 tools. Its context windo...
LangGraph Memory and State Persistence: Checkpointers, Threads, and Cross-Session Memory
TLDR: Checkpointers + thread IDs give LangGraph agents persistent memory across turns and sessions. š The Amnesia Problem: Why Stateless Agents Frustrate Users Your customer support agent is on its third message with a user. The user says: "As I ...
Human-in-the-Loop Workflows with LangGraph: Interrupts, Approvals, and Async Execution
TLDR: Pause LangGraph agents mid-run with interrupt(), get human approval, resume with Command. š The Autonomous Agent Risk: When Acting Without Permission Goes Wrong Your autonomous coding agent refactored the authentication module while you were...

Deploying LangGraph Agents: LangServe, Docker, LangGraph Platform, and Production Observability
TLDR: Swap InMemorySaver ā PostgresSaver, add LangServe + Docker, trace with LangSmith. š The Demo-to-Production Gap: Why Notebook Agents Fail at Scale Your LangGraph agent works perfectly in the demo. You deploy it to a single FastAPI instance. ...

LangGraph 101: Building Your First Stateful Agent
TLDR: LangGraph adds state, branching, and loops to LLM chains ā build stateful agents with graphs, nodes, and typed state. š The Stateless Chain Problem: Why Your Agent Forgets Everything You built a LangChain chain that answers questions. Then y...

Step-by-Step: How to Expose a Skill as an MCP Server
TLDR: Turn any Python function into a multi-client MCP server in 11 steps ā from annotation to Docker. š The Copy-Paste Problem: Why Skills Die at IDE Boundaries A developer pastes their summarize_pr_diff function into a Slack message because thei...

Headless Agents: Deploy Skills as MCP Servers ā Full Guide from Concept to Three Clients
TLDR: Build an MCP server once and call it from Cursor, Claude Desktop, and VS Code without rewrites ā this guide takes you from a single Python function to a containerized, authenticated, three-client deployment in 11 concrete steps. š The Trappe...
Functions in Python: Parameters, Return Values, and Scope
TLDR: Python functions are first-class objects, not just reusable blocks. They support keyword arguments, safe defaults with None, variadic *args/**kwargs, closures, and LEGB scope resolution. These five ideas are not advanced features ā they are the...
File I/O and Exception Handling in Python
š The Config File That Took Down a Friday Deployment Picture this: it's 5 PM on a Friday. A developer pushes a new service to production. The deployment succeeds, but five minutes later the service is dead ā a cascade of AttributeError: 'NoneType' o...
Python Data Structures: Lists, Dicts, Sets, and Tuples
TLDR: Python's four built-in collections are not interchangeable ā their internals are fundamentally different. list is a dynamic array: fast at the end, slow for membership. dict is a hash table: O(1) key lookup, insertion-order-preserving since Pyt...
Python Basics: Variables, Types, and Control Flow
TLDR: Python variables are labels that point at objects ā not typed boxes. The type lives with the object, not the variable. Master truthiness, f-strings, for/while loops, and the handful of pitfalls that trip up every developer coming from Java or J...
Mastering Prompt Templates: System, User, and Assistant Roles with LangChain
TLDR: A production prompt is not a string ā it is a structured message list with system, user, and optional assistant roles. LangChain's ChatPromptTemplate turns this structure into a reusable, testable, injection-safe blueprint. TLDR: LangChain p...
How to Develop Apps Using LangChain and LLMs
TLDR: LangChain is a framework that simplifies building LLM applications. It provides abstractions for Chains (linking steps), Memory (remembering chat history), and Agents (using tools). It turns raw API calls into composable building blocks. TLD...
Guide to Using RAG with LangChain and ChromaDB/FAISS
TLDR: RAG (Retrieval-Augmented Generation) gives an LLM access to your private documents at query time. You chunk and embed documents into a vector store (ChromaDB or FAISS), retrieve the relevant chunks at query time, and inject them into the LLM's ...
Python OOP: Classes, Dataclasses, and Dunder Methods
š Why Every Java Developer Writes Un-Pythonic Classes on Day One Imagine a developer ā let's call him Daniel ā who has written Java for six years. He sits down to write his first Python class and produces this: class BankAccount: def __init__(se...
Decorators Explained: From Functions to Frameworks
š The Copy-Paste Crisis: When Timing Code Invades Twenty Functions Sofia is three months into her first Python backend role. The team runs a performance review and discovers the data-processing API is slow. The tech lead asks her to add timing instr...
Async Python: asyncio, Coroutines, and Event Loops Without the Confusion
š The 500-Second Problem: What Cooperative Multitasking Actually Fixes Suppose your monitoring pipeline checks the health endpoint of 1,000 internal microservices. Each HTTP call takes about 500 milliseconds ā network round-trip, DNS, TLS handshake,...
LLM Evaluation Frameworks: How to Measure Model Quality (RAGAS, DeepEval, TruLens)
TLDR: š Traditional ML metrics (accuracy, F1) fail for LLMs because there's no single "correct" answer. RAGAS measures RAG pipeline quality with faithfulness, answer relevance, and context precision. DeepEval provides unit-test-style LLM evaluation....
LangChain RAG: Retrieval-Augmented Generation in Practice
ā” TLDR: RAG in 30 Seconds TLDR: RAG (Retrieval-Augmented Generation) fixes the LLM knowledge-cutoff problem by fetching relevant documents at query time and injecting them as context. With LangChain you build the full pipeline ā load ā split ā embed...

LangChain Memory: Conversation History and Summarization
TLDR: LLMs are stateless ā every API call starts fresh. LangChain memory classes (Buffer, Window, Summary, SummaryBuffer) explicitly inject history into each call, and RunnableWithMessageHistory is the modern LCEL replacement for the legacy Conversat...

