Python blueprints

Reference language for most code samples here. Official site: https://www.python.org/

AI Agent Workflows

Agent Tracing and Evaluation Setup

Capture structured traces of every LLM and tool call and run a small regression eval suite on each change.

observabilitytracingevalsopentelemetry
AI Agent Workflows

Human-in-the-Loop Approval Gate

Let agents draft freely but require explicit human approval before any irreversible or external action.

safetyapprovalside-effects
AI Agent Workflows

Planner-Executor Agent

Split a task into an explicit plan, execute steps one at a time, and re-plan only when a step fails.

planningdecompositionmulti-step
AI Agent Workflows

RAG Agent with Grounded Citations

Retrieval-augmented answering that cites source chunks and refuses when the context does not support an answer.

ragretrievalcitationsembeddings
AI Agent Workflows

ReAct Tool-Calling Agent Loop

A minimal, provider-agnostic reason-act-observe loop with a step budget, tool registry, and safe termination.

reacttool-uselooppython
AI Agent Workflows

Supervisor Multi-Agent Router

A supervisor agent delegates sub-tasks to specialist agents with narrow tools and merges their outputs.

multi-agentsupervisorrouting
Multi-Model Routing

Complexity-Based Cheap/Strong Model Router

Route easy requests to a cheap model and hard ones to a strong model using a lightweight classifier plus escalation.

routingcostclassifier
Multi-Model Routing

Local-First Routing with Ollama and Cloud Fallback

Serve requests from a local Ollama model, falling back to a cloud model only when local fails or the task needs it.

ollamalocalprivacyfallback
Multi-Model Routing

Semantic Response Cache in Front of LLM Calls

Reuse prior answers for near-duplicate prompts using embedding similarity with a strict threshold and TTL.

cachingembeddingscostlatency
Prompt & Agent Patterns

Reliable Structured JSON Output Pattern

Get valid, schema-conforming JSON from any model using native structured outputs where available, and validate-and-repair otherwise.

jsonschemavalidationextraction
MCP & Tool Use

Build a Custom MCP Server in Python (MCPServer, formerly FastMCP)

Expose your own functions as MCP tools and resources using the official Python SDK in about 20 lines.

mcppythonserversdk

Get one fully built blueprint a week

A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.