Blog

Posts

90 posts
The harness is the product: why AI agents fail

The harness is the product: why AI agents fail

I explain nyk's «The Harness Is The Product»: why the harness around the model decides whether an AI agent works in production, and its four...

Qwen Image 2.1 on two RTX 3090s: from a private Studio to ZeroGPU

Qwen Image 2.1 on two RTX 3090s: from a private Studio to ZeroGPU

How I tested Qwen Image 2.1 on two RTX 3090s, built a private Gradio Studio behind Tailscale and ported it to Hugging Face ZeroGPU. Results ...

How to run tools in parallel in an agent

How to run tools in parallel in an agent

Learn to decide which tools can run together, limit active operations and match each result to its request, with examples from Gymnasia.

Tool errors: how an agent recovers and when it must stop

Tool errors: how an agent recovers and when it must stop

How to communicate tool errors to a model, allow useful recovery and prevent duplicate saves. Contracts, the tool cycle, providers and tests...

Validating tool calls: declaring a schema is not enough

Validating tool calls: declaring a schema is not enough

How to check tool arguments before execution, return errors the model can correct, and test the contract without changing user data.

Streaming an agent response: from SSE events to text on screen

Streaming an agent response: from SSE events to text on screen

How an agent shows the LLM response as it is generated: splitting SSE events, separating reasoning from the answer and batching renders to k...

The agent loop: feeding tool results back and knowing when to stop

The agent loop: feeding tool results back and knowing when to stop

How a harness closes the tool call cycle: run the tools, feed results back into the history, call the model again and stop with a round limi...

Qwen3.8-27B locally on two RTX 3090s: vLLM, MTP and a private API

Qwen3.8-27B locally on two RTX 3090s: vLLM, MTP and a private API

How I installed Qwen3.8-27B on a PC with two RTX 3090s: vLLM vs llama.cpp benchmarks, MTP, TP vs PP and an on-demand private API over Tailsc...

From a tool call to executable code: an agent dispatcher

From a tool call to executable code: an agent dispatcher

How an agent turns the name and arguments of a tool call into a local function, handles errors, and returns the result to the model.

Streaming tool calls: accumulate arguments without executing halfway

Streaming tool calls: accumulate arguments without executing halfway

How to accumulate arguments delivered as streaming deltas and why a tool must never run before the provider sends its terminal event.

How to parse tool calls from OpenAI, Anthropic and Google

How to parse tool calls from OpenAI, Anthropic and Google

How to turn tool calls from different LLM providers into one common interface without losing the identifiers that correlate each result.

How to declare reliable tools for OpenAI, Anthropic and Google

How to declare reliable tools for OpenAI, Anthropic and Google

A practical guide to designing tools an LLM can discover, adapting them to any LLM provider, executing them safely, and protecting them with...

Gymnasia: architecture of an AI agent that runs on the phone

Gymnasia: architecture of an AI agent that runs on the phone

How the Gymnasia AI agent is built: a BYOK coach with local tools and a food estimator that reads macros from a photo, all running on the ph...

Deep Research with LangGraph (3/3): the Writer agent and final report

Deep Research with LangGraph (3/3): the Writer agent and final report

Part 3 of Deep Research with LangGraph: the Writer agent drafts the final report, the full graph is assembled and the assistant runs end to ...

Deep Research with LangGraph (2/3): multi-agent Research Supervisor

Deep Research with LangGraph (2/3): multi-agent Research Supervisor

Part 2 of Deep Research with LangGraph: build a Research Supervisor that coordinates parallel Researcher agents and decides when there is en...

Build a Deep Research AI Agent with LangGraph (1/3)

Build a Deep Research AI Agent with LangGraph (1/3)

Build an AI research assistant with LangGraph. Part 1: system architecture, a Scope agent that clarifies the request, and a Researcher agent...

MCP Elicitation Tutorial: Human-in-the-Loop FastMCP

MCP Elicitation Tutorial: Human-in-the-Loop FastMCP

Build an interactive MCP server with FastMCP that collects user input in real time. Full Python example with elicit(), a confirmation tool, ...

MCP Durability: Persistence for Long Tasks

MCP Durability: Persistence for Long Tasks

Build durable MCP servers with SQLite persistence for long-running tasks. FastMCP tutorial with background task management and restart recov...

Resumable MCP: Automatic Checkpoints

Resumable MCP: Automatic Checkpoints

Build resumable MCP servers with automatic checkpoints using FastMCP. Handle task interruptions with state persistence and recovery for long...

FastMCP Streaming Tutorial: Progress Tracking & File Upload

FastMCP Streaming Tutorial: Progress Tracking & File Upload

FastMCP streaming tutorial: report_progress for long tasks, file upload with progress bars, and StreamableHttpTransport with Uvicorn. Full P...

LangGraph (4/4): state customization and checkpoints

LangGraph (4/4): state customization and checkpoints

Final part of the LangGraph guide: customize the graph state with your own schemas and reducers, and use checkpoints to inspect, recover and...

LangGraph (3/4): long-term memory and human-in-the-loop

LangGraph (3/4): long-term memory and human-in-the-loop

Third part of the LangGraph guide: long-term memory across threads so the agent remembers between conversations, plus human-in-the-loop to a...

LangGraph (2/4): short-term memory

LangGraph (2/4): short-term memory

Second part of the LangGraph guide: add short-term memory to your chatbot with checkpointers, recover past conversations and store state in ...

LangGraph (1/4): basic chatbot and tools

LangGraph (1/4): basic chatbot and tools

Part 1 of the complete LangGraph guide: how it works, installing it, setting up API keys, and building your first chatbot with a state graph...

MCP with FastMCP (4/4): HTTP, authentication and the MCP client

MCP with FastMCP (4/4): HTTP, authentication and the MCP client

Final part of the MCP with FastMCP guide: serve over HTTP, add Bearer token and RSA key authentication, and connect an MCP client to consume...

MCP with FastMCP (3/4): advanced resources and prompts

MCP with FastMCP (3/4): advanced resources and prompts

Third part of the MCP with FastMCP guide. Add context to your resources, create parameterized resource templates and define reusable prompts...

MCP with FastMCP (2/4): transport layer, context and resources

MCP with FastMCP (2/4): transport layer, context and resources

Second part of the MCP with FastMCP guide: configure the transport layer, exclude tool arguments, access the request context and create your...

MCP Tutorial with FastMCP: Your First Server (1/4)

MCP Tutorial with FastMCP: Your First Server (1/4)

Get started with the Model Context Protocol using FastMCP: build your first MCP server and expose functions as tools with @mcp.tool via a Gi...

AI Agent Patterns: Design & Architecture

AI Agent Patterns: Design & Architecture

Are your agents falling short? Elevate your AI projects with advanced patterns: ReAct, planning, multi-agents, and more. Practical guide wit...

uv: Fast Alternative to conda and venv

uv: Fast Alternative to conda and venv

Discover uv, the Python package manager written in Rust. Create environments and install dependencies up to 100x faster than conda and venv.

FastRTC Tutorial: Real-Time Voice AI (STT + LLM + TTS)

FastRTC Tutorial: Real-Time Voice AI (STT + LLM + TTS)

Build a real-time voice assistant in Python with FastRTC: STT, LLM and TTS in one pipeline. From setup to phone-call integration, with full ...

Wan2.1-T2V-14B: Video Generation with HF

Wan2.1-T2V-14B: Video Generation with HF

Do you want to have your own Sora, but also generate good videos? In this post I explain how to do it with HuggingFace Inference Providers a...

Deploy backend with LLM in HuggingFace

Deploy backend with LLM in HuggingFace

Do you want to deploy a backend with your own LLM? In this post I explain how to do it with HuggingFace Spaces, FastAPI, Langchain and Docke...

Langchain with open source integrations

Langchain with open source integrations

Use LangChain with open-source integrations: ChromaDB, Ollama, and HuggingFace. Practical guide to building AI apps with free tools.

unittest in Python: Unit Testing Guide

unittest in Python: Unit Testing Guide

Python unittest tutorial: write unit tests, measure test coverage, and refactor confidently. Complete guide with practical examples using th...

RAG Fundamentals: Retrieval Augmented Gen

RAG Fundamentals: Retrieval Augmented Gen

Learn RAG fundamentals: build a retrieval-augmented generation system with Hugging Face and ChromaDB. Step-by-step question-answering tutori...

Conventional Commits: Git Standard Guide

Conventional Commits: Git Standard Guide

Learn Conventional Commits for clean Git history. Use commitizen and git-changelog to standardize commit messages and automate changelogs.

DoLa: Cut LLM Hallucinations by Contrasting Layers

DoLa: Cut LLM Hallucinations by Contrasting Layers

DoLa explained: decoding by contrasting layers boosts LLM factuality and cuts hallucinations, no retraining. Code examples with Hugging Face...

QLoRA Explained: NF4 Quantization & Paged Optimizers

QLoRA Explained: NF4 Quantization & Paged Optimizers

QLoRA paper explained: NF4 4-bit quantization, double quantization, and paged optimizers for efficient LLM fine-tuning. Practical BitsAndByt...

GPTQ Quantization Explained + GPTQConfig Tutorial

GPTQ Quantization Explained + GPTQConfig Tutorial

How GPTQ post-training quantization works for LLMs, explained from the paper. Hands-on GPTQConfig tutorial with Hugging Face: shrink models ...

llm.int8(): 8-bit Quantization for Transformers

llm.int8(): 8-bit Quantization for Transformers

Learn llm.int8() quantization to reduce LLM size without losing accuracy. Use 8-bit matrix multiplication with Transformers for efficient in...

LLM Quantization: Optimize Model Size

LLM Quantization: Optimize Model Size

Guide to LLM quantization: FP16, INT8, FP4, QLoRA, AWQ, GGUF, and more. Reduce model size for deployment on limited devices without losing a...

LoRA: Low-Rank Adaptation for LLMs

LoRA: Low-Rank Adaptation for LLMs

Learn LoRA (Low-Rank Adaptation) for efficient neural network fine-tuning with PyTorch. Adapt large models with minimal GPU resources and pr...

Fine-Tuning Florence-2: Computer Vision

Fine-Tuning Florence-2: Computer Vision

Step-by-step guide to fine-tuning Florence-2 multimodal model with PyTorch. Learn data preparation, hyperparameter setup, and vision-languag...

Fine-Tuning GPT-2 with Hugging Face Transformers & Trainer

Fine-Tuning GPT-2 with Hugging Face Transformers & Trainer

Step-by-step GPT-2 fine-tuning with Hugging Face Transformers: tokenizer text_target, DataCollatorForLanguageModeling, and Trainer. Complete...

GPT-2 Explained: Architecture, Model Sizes (124M–1.5B) & GPT2LMHeadModel

GPT-2 Explained: Architecture, Model Sizes (124M–1.5B) & GPT2LMHeadModel

GPT-2 paper explained: architecture, model sizes (124M, 355M, 774M, 1.5B parameters), and how to use GPT2LMHeadModel with Hugging Face Trans...

Florence-2: Multimodal Vision Model

Florence-2: Multimodal Vision Model

Explore Florence-2, Microsoft multimodal model with 200M-700M parameters that outperforms larger models. A versatile SOTA vision-language mo...

GPT-1: Generative Pre-Training for NLU

GPT-1: Generative Pre-Training for NLU

Deep dive into the GPT-1 paper: understand how generative pre-training works for NLP. Includes fine-tuning examples with Hugging Face and Py...

BPE Tokenizer: Subword Encoding Algorithm

BPE Tokenizer: Subword Encoding Algorithm

Understand BPE (Byte Pair Encoding) tokenization for NLP. Learn how this popular method splits text into tokens with step-by-step examples a...

Hugging Face Optimum: Fast Inference

Hugging Face Optimum: Fast Inference

Speed up PyTorch models with Hugging Face Optimum. Accelerate training and inference with ONNX Runtime optimization. Compatible with Transfo...

Ollama: Run LLMs Locally with Ease

Ollama: Run LLMs Locally with Ease

Run LLMs locally with Ollama. Use quantized language models on any machine with Docker-like simplicity. Fast inference with minimal memory r...

Accelerate: Saving, Mixed Precision and Inference (2/2)

Accelerate: Saving, Mixed Precision and Inference (2/2)

Save and load models with Hugging Face Accelerate, train with FP16/BF16/FP8 mixed precision, and run inference with the Hugging Face ecosyst...

Hugging Face Accelerate: Multi-GPU & TPU Training Guide

Hugging Face Accelerate: Multi-GPU & TPU Training Guide

Set up Hugging Face Accelerate and run your PyTorch training loop on multiple GPUs and TPUs. Step-by-step config, process control, and hands...

Hugging Face Evaluate: ML Metrics Guide

Hugging Face Evaluate: ML Metrics Guide

Master Hugging Face Evaluate library to measure NLP model performance. Automate metric calculations for accuracy, F1, BLEU, and more with pr...

Hugging Face Datasets: Data Management

Hugging Face Datasets: Data Management

Learn Hugging Face Datasets library: load, preprocess, and manage NLP datasets efficiently. Replace manual CSV handling with streamlined dat...

Hugging Face Transformers: NLP Models

Hugging Face Transformers: NLP Models

Complete Hugging Face Transformers guide: use pipeline, AutoModel, and fine-tuning for NLP tasks. Generate text, train models, and share on ...

git-sim: Visualize Git Commands

git-sim: Visualize Git Commands

git-sim tutorial: visually simulate Git commands before executing them. Test rebase, reset, merge, and more with graphical previews to avoid...

Hugging Face Tokenizers: Fast Encoding

Hugging Face Tokenizers: Fast Encoding

Guide to Hugging Face Tokenizers library: transform text into structured data for AI models. Practical Python examples for efficient NLP tok...

Transformers – from top to the bottom

Transformers – from top to the bottom

Discover transformers 🚀. Learn the architecture behind all the new language models. Don't ask an AI, come in and learn

ChromaDB Python Tutorial: Queries & Dimension Error Fix

ChromaDB Python Tutorial: Queries & Dimension Error Fix

ChromaDB in Python: create collections, query embeddings, and fix InvalidDimensionException. Hands-on guide with query_embeddings and hnsw:s...

Regular Expressions: Complete Guide

Regular Expressions: Complete Guide

Master regular expressions from basics to advanced techniques. Practical guide with Python examples for text search, extraction, and pattern...

CSS Tutorial: Flexbox, Grid & Web Design

CSS Tutorial: Flexbox, Grid & Web Design

Complete CSS guide covering selectors, properties, box model, layout, colors, and fonts. Practical examples for beginners and intermediate w...

Mixtral 8x7B: Mixture of Experts Model

Mixtral 8x7B: Mixture of Experts Model

Mixtral-8x7B guide: explore the Mixture of Experts architecture by Mistral AI. Learn how to use it with Hugging Face Transformers and Gradio...

Embedding Similarity: Distance Metrics

Embedding Similarity: Distance Metrics

Discover how similarity is measured between embeddings, the basis of the attention mechanism of transformers and RAG algorithms

Embeddings: Vector Representations in AI

Embeddings: Vector Representations in AI

Learn what embeddings are and how they work in NLP. Tutorial covering Word2Vec, GloVe, BERT, and Hugging Face Transformers with practical ex...

Tokens in NLP: Text Tokenization Guide

Tokens in NLP: Text Tokenization Guide

Learn what tokens are in NLP and how tokenization works. Understand OpenAI tiktoken, GPT-4, and text-embedding tokenizers with practical exa...

OpenAI API: Integration & Practical Guide

OpenAI API: Integration & Practical Guide

Complete OpenAI API tutorial: learn to use GPT for text generation, DALL-E for images, and more. Setup, installation, and practical Python e...

HTML Tutorial: Semantic Web Structure

HTML Tutorial: Semantic Web Structure

Learn HTML, the markup language used to create web pages. Learn how to structure the content of a web page and format it with HTML.

Fail2ban: Linux Server Protection

Fail2ban: Linux Server Protection

Fail2Ban tutorial: protect your Linux server from brute force attacks. Complete guide covering installation, configuration, and SSH security...

Caffeine: Prevent macOS Sleep Mode

Caffeine: Prevent macOS Sleep Mode

Install and use Caffeine on Ubuntu Linux to prevent sleep mode during long tasks. Simple setup guide to keep your system awake when you need...

Conda: Python Environment Management

Conda: Python Environment Management

Conda vs Pip comparison: manage Python packages and environments for data science. Learn Conda and Mamba for faster dependency resolution.

Git (3/3): remote repositories, stash and tags

Git (3/3): remote repositories, stash and tags

Third part of the Git guide: remote repositories ☁️, aliases, stash and tags to version your code like a programming rockstar. 🎸 #GITandRol...

Git (2/3): branches

Git (2/3): branches

Second part of the Git guide. Master branches 🌳: create, switch, merge and resolve conflicts like a programming rockstar. 🎸 #GITandRoll

Git (1/3): local version control

Git (1/3): local version control

Overwrote code that took you hours? Do not panic! First part of the Git guide: local version control for your project like a programming roc...

Whisper: AI Audio Transcription by OpenAI

Whisper: AI Audio Transcription by OpenAI

👂 You don't get to gossip what the first one says? With whisper you can not only do it, but also translate it if you want. Log in and learn...

SSH Guide: Secure Remote Connections

SSH Guide: Secure Remote Connections

Complete SSH tutorial: establish encrypted connections to remote servers. Learn key generation, configuration, and advanced tips for secure ...

BLIP-2: Multimodal Vision-Language Model

BLIP-2: Multimodal Vision-Language Model

BLIP-2 tutorial: multimodal AI model that answers questions about images. Learn visual question answering and image captioning with practica...

Neural Networks: Linear Regression Step by Step

Neural Networks: Linear Regression Step by Step

Learn how a neural network works with Python: linear regression, loss function, gradient, and training. Hands-on tutorial with code.

Neural Networks: History and Key Milestones

Neural Networks: History and Key Milestones

Learn how neural networks work, their history since the 1950s, the AI Winter, and how ImageNet revolutionized AI in 2012. Beginner-friendly ...

Bash Scripting: Linux Automation Guide

Bash Scripting: Linux Automation Guide

Complete Bash scripting tutorial for Linux: learn variables, loops, conditionals, functions, and automation. Master the terminal from beginn...

Docker (2/2): Docker Compose and advanced topics

Docker (2/2): Docker Compose and advanced topics

🐳 Second part of the Docker guide: orchestrate several containers with Docker Compose and master advanced topics to level up your developme...

Docker (1/2): containers, images and applications

Docker (1/2): containers, images and applications

🐳 First part of the Docker guide: containers, data and volumes, images, applications and GPUs. No more "it works on my machine".

Terminal (3/3): system administration

Terminal (3/3): system administration

🟢 Third part of the terminal guide. Administer the system 🖥: memory, disk, packages, users, security and command scheduling in the termina...

Terminal (2/3): network, compression and processes

Terminal (2/3): network, compression and processes

🟢 Second part of the terminal guide. Master network utilities 🌐, file compression and managing background and foreground processes 💻 like...

Terminal (1/3): navigation, files and commands

Terminal (1/3): navigation, files and commands

🟢 First part of the terminal guide: move around the console 💻, handle files, permissions, redirections, environment variables and search l...

Data management with Pandas

Data management with Pandas

Complete Pandas tutorial: learn data analysis, manipulation, cleaning, and visualization in Python. Practical guide with real-world examples...

Matrix calculation with NumPy

Matrix calculation with NumPy

NumPy tutorial: master matrix operations, array manipulation, and scientific computing in Python. Complete guide with practical examples and...

Complete Python Guide 2025 (3/3): classes, objects and advanced topics

Complete Python Guide 2025 (3/3): classes, objects and advanced topics

Third part of the complete Python guide: classes and objects, iterators, scope, modules and packages, try/except error handling and the Zen ...

Complete Python Guide 2025 (2/3): operators, control flow, functions

Complete Python Guide 2025 (2/3): operators, control flow, functions

Second part of the complete Python guide. Master operators, control flow (if, for, while) and functions, including lambda, map, filter and r...

Complete Python Guide 2025 (1/3): data types

Complete Python Guide 2025 (1/3): data types

First part of the complete Python guide: strings, numbers, lists and tuples, dictionaries, sets, booleans and binary data, with practical ex...

Have you seen these projects?

Gymnasia

Gymnasia Gymnasia
Expo
React Native
TypeScript
OpenAI
Anthropic

Fitness app with two agents that run entirely on the device, with no backend, so the user's data never leaves the phone. A BYOK conversational coach with local tools and a remote system prompt with offline fallback, plus a food estimator that pulls macronutrients out of a photo of the plate, with barcode scanning against OpenFoodFacts.

LangGraph Deep Researcher

LangGraph Deep Researcher LangGraph Deep Researcher
Python
LangGraph
FastAPI
React
TypeScript
Docker

Multi-agent research system built with LangGraph. A supervisor breaks your question down into topics and launches search sub-agents in parallel; each one compresses its findings before handing them to a writer agent that produces the final sourced markdown report. Live streaming over WebSockets, a configurable model per role and bring-your-own API keys that are never persisted server-side.

Tau

Tau Tau
Python
LangChain

Multi-agent tutoring system for secondary school students, with one agent per subject and course material written and validated by a team of teachers. It was used with real students at a private school in Spain and at a secondary school in Colombia.

View all projects -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to watch any talk?

Last talks -->

Do you want to improve with these tips?

Last tips -->

Use this locally

Hugging Face spaces allow us to run models with very simple demos, but what if the demo breaks? Or if the user deletes it? That's why I've created docker containers with some interesting spaces, to be able to use them locally, whatever happens. In fact, if you click on any project view button, it may take you to a space that doesn't work.

Flow edit

Flow edit Flow edit

FLUX.1-RealismLora

FLUX.1-RealismLora FLUX.1-RealismLora
View all containers -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to train your model with these datasets?

short-jokes-dataset

HuggingFace

Dataset with jokes in English

Use: Fine-tuning text generation models for humor

231K rows 2 columns 45 MB
View on HuggingFace →

opus100

HuggingFace

Dataset with translations from English to Spanish

Use: Training English-Spanish translation models

1M rows 2 columns 210 MB
View on HuggingFace →

netflix_titles

HuggingFace

Dataset with Netflix movies and series

Use: Netflix catalog analysis and recommendation systems

8.8K rows 12 columns 3.5 MB
View on HuggingFace →
View more datasets -->