Adamant Tools blog: practical AI engineering
Tested, practical guides for developers who put AI models into real applications: APIs, streaming, tools, RAG, costs, errors and security. Every code sample compiles and runs.

Timeouts and cancellation for LLM calls: idle timeout, total deadline, stop button (Python, Node.js)
A model call can be slow, silent or endless. Four kinds of timeout, why a read timeout never stops a streaming answer, and tested Python and Node.js code with a cancel.

Ollama in Docker on a server without a GPU: what to expect and how to measure it
Run Ollama in Docker on a CPU-only server, keep the model loaded, limit memory and queue, and measure load time and tokens per second from the API response.

Expose a REST API as an MCP server, safely (Python, MCP SDK 2.x)
Turn a few operations of an OpenAPI-described REST API into MCP tools with the official Python SDK - an allow-list of operations and response fields, strict input validation, a fixed base URL, the server's own credentials, short errors and a rate limit - tested with the SDK client and no API key.

Prompt injection: practical defenses you can test (Python and JavaScript)
What prompt injection is, why no filter stops it, and five defenses in code that limit the damage - separating data from instructions, a tool allow-list, argument checks with the user's permissions, human confirmation and output validation - tested with malicious inputs.

Minimal RAG with PostgreSQL and pgvector and a local model (Python)
Store embeddings in PostgreSQL with pgvector, search them with an HNSW index and cosine distance, and answer with a local Ollama model that cites its sources. Tested in CI without a model.

Tool calling explained with an example that runs (Anthropic and OpenAI, Python)
What really happens when a model calls a function, a manual loop for the Anthropic Messages API and the OpenAI Responses API, error handling, a step limit, and tests against a fake server with no API key.

Count tokens and estimate costs before you call a model (Python and JavaScript)
Three ways to count tokens (local tokenizer, provider endpoint, usage), how to turn them into a cost range, and a budget check that blocks expensive calls.

HTTP 429 from AI APIs: retry with backoff and Retry-After (Python, Node.js, Java)
When a model API answers 429 Too Many Requests, retrying immediately makes things worse. What the standards say, which errors to retry, and tested retry code with no dependencies in Python, JavaScript and Java.

Calling an LLM from Spring Boot with Spring AI 2.0: chat, streaming and structured output
A tested Spring Boot 4.1 + Spring AI 2.0 example with a local Ollama model: a plain answer, a streamed answer and an answer mapped to a Java record, plus the configuration changes that break older tutorials.

Stream an LLM answer to the browser with Server-Sent Events (FastAPI + fetch)
Show a model's answer word by word: a FastAPI endpoint that relays Ollama as SSE, browser code that reads it with fetch and POST, and a working Stop button.