Python

29 pieces on Python, including 24 step-by-step guides.

Guides

Run SGLang Offline Batch Inference Directly from Python
guides
Shan • 2026-10-10
sglangllm inferencebatch processingpythongpuradixattention

Run SGLang Offline Batch Inference Directly from Python

Use SGLang's offline_batch_inference.py pattern to batch-generate text without an HTTP server.

Read more →
Generate Synthetic RAG Test Sets With Ragas
guides
Shan • 2026-10-04
RagasRAGEvaluationPythonLangChain

Generate Synthetic RAG Test Sets With Ragas

Build, save and reuse a Ragas knowledge graph to generate single-hop and multi-hop evaluation queries from Markdown documents.

Read more →
Generate and Run a Python Expression with Outlines
guides
Shan • 2026-10-02
OutlinesOpenAIPythonstructured generationLLMs

Generate and Run a Python Expression with Outlines

Use Outlines and GPT-4o mini to turn a word problem into a Python expression, execute it, and understand the risks of eval.

Read more →
Build a Multi-Tool Claude Agent with MCP Servers in Python
guides
Shan • 2026-10-01
claudemcpagentspythonanthropic

Build a Multi-Tool Claude Agent with MCP Servers in Python

Wire Claude to a local calculator, Brave search MCP server, and Anthropic-hosted tools in one extensible Python agent loop.

Read more →
Automate Prompt Optimization with DSPy GEPA
guides
Shan • 2026-09-28
DSPyprompt optimizationLLMGEPAPython

Automate Prompt Optimization with DSPy GEPA

Use DSPy's GEPA optimizer to automatically improve LLM prompts with scored examples and a reflection model — no hand-tuning required.

Read more →
Build a Grounded Search Agent with Google ADK
guides
Shan • 2026-09-28
google-adkagentsgeminiretrieval-augmented-generationpythongoogle-search

Build a Grounded Search Agent with Google ADK

Build a web-grounded AI agent with Google ADK's built-in google_search tool, from pip install to a grounded answer in the ADK dev UI.

Read more →
Build a Multi-Agent Financial Research Bot with OpenAI Agents SDK
guides
Shan • 2026-09-28
openai-agentsmulti-agentfinancial-researchpythonasyncio

Build a Multi-Agent Financial Research Bot with OpenAI Agents SDK

Run the OpenAI Agents SDK financial research example: a planner, web-search agent, analyst tools, writer and evidence verifier.

Read more →
Build a Multi-Agent Sequential Pipeline with Semantic Kernel
guides
Shan • 2026-09-28
semantic-kernelmulti-agentazure-openaiorchestrationpython

Build a Multi-Agent Sequential Pipeline with Semantic Kernel

Wire three specialised agents into an ordered pipeline using Semantic Kernel's SequentialOrchestration and InProcessRuntime — no glue code required.

Read more →
Build a Routed RAG Chatbot with LlamaIndex and Chainlit
guides
Shan • 2026-09-24
RAGLlamaIndexChainlitNVIDIA NIMPython

Build a Routed RAG Chatbot with LlamaIndex and Chainlit

Dispatch queries across independent retrieval pipelines using LlamaIndex QueryFlow, Chainlit, and NVIDIA NIM endpoints.

Read more →
Chain of Verification with SGLang: Reduce LLM Hallucinations
guides
Shan • 2026-08-29
SGLanghallucinationLLM inferencechain-of-verificationPython

Chain of Verification with SGLang: Reduce LLM Hallucinations

Build a factored Chain-of-Verification pipeline with SGLang that runs draft, verify, refine, and summarize as independent LLM calls.

Read more →
guides
Shan • 2026-08-21
ClaudeWatermarkingC2PAPythonAI Governance

How to Remove Claude Watermarks from Text, Code, and Files

A practical guide to handling Claude watermarks across prose, Python code, and C2PA-marked files, with rewrite and inspection code.

Read more →
AI Web Scraping in Python: When an LLM Earns Its Cost
guides
Shan • 2026-08-17
web scrapingCrawl4AIPythonLLMdata extractionautomation

AI Web Scraping in Python: When an LLM Earns Its Cost

An LLM can read any page without a selector, and it bills you every time. Here is the decision rule, the Crawl4AI code for both paths, and the hybrid that pays for a model once and then runs free.

Read more →
Generate Video with Google Veo 3.1 and the Gemini Python SDK
guides
Shan • 2026-08-12
video generationGemini APIPythonVeogenerative AI

Generate Video with Google Veo 3.1 and the Gemini Python SDK

Call the Veo 3.1 API from Python to generate MP4s from text prompts, images, and reference assets — including audio, first/last frame control, and video extension.

Read more →
Run parallel Claude agents with asyncio and a message hub
guides
Shan • 2026-08-10
agentsasyncioanthropicorchestrationpython

Run parallel Claude agents with asyncio and a message hub

Build a lightweight Python orchestration layer that runs multiple Claude agents concurrently, routes messages between them via a shared hub, and synthesises results.

Read more →
Build a Deep Research API Agent Pipeline with OpenAI
guides
Shan • 2026-08-09
openaideep-researchagentspythonmcp

Build a Deep Research API Agent Pipeline with OpenAI

Run a four-agent Deep Research pipeline—clarification, prompt enrichment, MCP file search, and citation extraction—using OpenAI's agents SDK.

Read more →
guides
Shan • 2026-05-24
Qwen3OllamaLocal LLMsPythonReasoning Models

How to Run Qwen3 Locally with Ollama: Setup, API, and a Gradio App

Set up Qwen3 locally in minutes using Ollama. Covers every model variant, thinking mode control with /think and /no_think tags, CLI, REST API, Python SDK, and a practical Gradio reasoning app.

Read more →
guides
architect • 2026-05-23
Local LLMProjectsPythonAutomation

5 Cool Things I Did With Local Language Models

Discover five unique, practical, and incredibly fun projects you can build on consumer hardware using open source local LLMs.

Read more →
guides
AI Mastery Team • 2026-05-23
RAGEvaluationLLMsPython

Mastering Advanced RAG Evaluation: From Basic Metrics to LLM-as-a-Judge

Learn how to systematically evaluate Retrieval-Augmented Generation (RAG) pipelines using the RAG Triad, Ragas, and LLM-as-a-Judge techniques.

Read more →
guides
architect • 2026-05-23
PythonSearchEmbeddingsLLMsNLP

Building Context-Aware Search in Python with LLM Embeddings and Metadata

A complete guide to constructing a semantic engine using SentenceTransformers and pre-filtering metadata to return context-rich results.

Read more →
RAG vs MCP in 2026: What Each Solves and How They Fit Together
guides
Shan • 2026-05-14
RAGMCPModel Context ProtocolAI AgentsPythonArchitecture

RAG vs MCP in 2026: What Each Solves and How They Fit Together

RAG is a technique for grounding answers in your data; MCP is a protocol for connecting models to tools and data. Build an MCP server and see where RAG fits.

Read more →
guides
Bala Priya C • 2026-04-29
PythonAgentsPydantic

Building AI Agents in Python with Pydantic AI

Learn how to build production-ready AI agents in Python using Pydantic AI, with structured outputs, custom tools, and dependency injection.

Read more →
Build a Tool-Calling Agent with a Local Small Model and Ollama (2026)
guides
Shan • 2026-04-25
OllamaAI AgentsTool CallingSmall Language ModelsLocal LLMsPython

Build a Tool-Calling Agent with a Local Small Model and Ollama (2026)

Give a local small language model tools with Ollama's Python library: function tools, multi-tool streaming with thinking, and validated JSON output.

Read more →
Self-Verification for AI Agents: Build an Evaluator-Optimizer Loop in LangGraph
guides
Shan • 2026-04-14
AI AgentsLangGraphSelf-VerificationLLM-as-a-JudgePythonReliability

Self-Verification for AI Agents: Build an Evaluator-Optimizer Loop in LangGraph

Stop agent errors compounding: a generator drafts, an evaluator returns a structured verdict with feedback, and LangGraph loops until it passes.

Read more →
Getting Started with LangChain in 2026: Build a RAG Agent and a RAG Chain
guides
Shan • 2026-04-05
LangChainRAGPythonAI AgentsOpenAIVector Search

Getting Started with LangChain in 2026: Build a RAG Agent and a RAG Chain

Build retrieval-augmented generation two ways with LangChain 1.x: an agent that calls a retrieval tool, and a chain that injects context every time.

Read more →

News & Analysis

news
Shan • 2026-09-07
Agentic AIMulti-Agent SystemsProduction MLPythonLLM Evaluation

40% of Production AI Failures Are Silent: Fix With a Watchdog

Datadog data shows 40% of production AI failures return HTTP 200. A lightweight 1B-parameter watchdog at each handoff seam catches what output-level eval cannot.

Read more →
news
Shan • 2026-09-02
PythonData EngineeringData SciencePerformanceOpen Source

FireDucks Beats Pandas by Up to 20.77x on 10M-Row Benchmarks

NEC's FireDucks hits 20.77x faster sorting and 7.28x geometric mean speedup over pandas across 7 workloads — with just one import change.

Read more →
news
Shan • 2026-09-01
PythonObservabilityAI-Assisted ProgrammingOpen SourceAgentic Engineering

wrapture Unifies Python Mocking and Tracing in One Primitive

Graham Dumpleton's new library brings wrapt-style monkeypatching to both test stubs and production tracing — with zero source changes required.

Read more →
news
Shan • 2026-08-31
Large Language ModelsData EngineeringPydanticPythonStructured Output

Valid JSON, Wrong Data: Where Structured Outputs Stop Working

Structured Outputs guarantee schema shape, not truth. Here's the three-layer fix for silent data corruption in LLM extraction pipelines.

Read more →
news
Shan • 2026-08-09
AI AgentsNVIDIAPythonOpen SourceBenchmarksLLM Infrastructure

NOOA: NVIDIA's Object-Oriented Agent Framework Explained

NVIDIA open-sources NOOA, a Python framework that collapses prompt templates, tool schemas, and workflow graphs into one class—with 82.2% on SWE-bench Verified.

Read more →