IAMUVIN

AI & Machine Learning

Integrate language models into applications with retrieval, tool use, streaming, and evaluation. The RAG and agent architecture articles cover how the pieces fit together.

21 articles

AI & Machine Learning17 min
IAMUVIN

Your Agent Benchmark Number Is Mostly Your Harness

Scale AI's standardised SWE-Bench Pro public set tops out at 61.50% across 731 instances, though even that board is mixed: its top rows ran mini-swe-agent under capped cost, not the board's standard SWE-Agent scaffold at 250 turns with uncapped cost. Anthropic reported 81.2% for Claude Fable 5.1 on the same benchmark name, with no scaffold or subset stated. Both numbers are real. They measure different systems. Terminal-Bench 4.0 is worse — one model, three reporters, three scores: 55.8%, 55.1% and 57.88%. Anthropic changed only the container resources on Terminal-Bench 2.0, held the model and harness fixed, and moved the score 6 percentage points with p below 0.01. Their stated conclusion is that, until resource methodology is standardised, their data suggests leaderboard differences below 3 percentage points deserve skepticism until the eval configuration is documented and matched. This article separates the four things a leaderboard row actually measures — model, scaffold, resource budget and timeout — shows what SWE-Bench Pro, Terminal-Bench 4.0 and tau2-bench each test, explains why Amazon Nova Micro 1.0 outranks a frontier model on a saturated benchmark, and gives you the configuration manifest and the pass^k decision you need to build an eval for your own system.

U
Uvin Vindula·September 14, 2026
AI & Machine Learning16 min
IAMUVIN

Tokens Per Task: The Real AI Cost Model in 2026

Terminal-Bench 4.0's maintainers published the number that kills every dollars-per-million comparison: Claude Sonnet 5 burned 21.6 billion tokens on its leaderboard run against 6.5 billion for Opus 5, and scored 12.4% against 51.8%. The cheaper model per million spent 3.3 times the tokens for a quarter of the completions. Then there is the tokenizer — Claude 4.7 and later produce roughly 30% more tokens for identical text, so Sonnet 5 at $2 against Sonnet 4.6 at $3 is about a 13% real saving, not 33%. Prompt caching was repriced at two of the three major vendors in 2026: OpenAI now charges 1.25x for cache writes with a 30-minute reuse window, Anthropic dropped Fable 5.1 cache reads to 0.025x, and Google alone still bills per-hour cache storage. This article gives the current price tables with measurement dates, the silent cache-miss mechanisms, the exact fields to log for cost per completed task, and the session-runtime SKU that no price table shows.

U
Uvin Vindula·September 14, 2026
AI & Machine Learning16 min
IAMUVIN

Multi-Agent Systems Are a Context Decision, Not an Org Chart

Use a skill when the work needs instructions. Use a subagent when it needs a separate context window. Use MCP when it needs a tool outside your process. The planner, implementer, tester and reviewer diagram in every multi-agent post is the decomposition Anthropic's own guidance says fails — teams that built it spent more tokens on coordination than on work, and multi-agent setups typically burn 3-10x the tokens of a single agent for the same task. This guide covers the rule that replaces it: decompose by shared context, never by job title, and never split sequential phases of one feature, because each handoff degrades fidelity. It covers the three triggers that genuinely justify a second agent, the one role split that reliably works and why, the documented failure mode of that split and its mitigation, what an orchestrator actually costs once you add session runtime billing, and how skills, subagents and MCP differ as primitives. Written for engineers who have already drawn the boxes and are wondering why the pipeline is slower and worse than the thing it replaced.

U
Uvin Vindula·September 11, 2026
AI & Machine Learning17 min
IAMUVIN

Context Engineering: Why Compaction Is the Wrong First Lever

Context editing is a server-side Claude API feature. So is compaction, since `compact_20260112` shipped in January 2026 — but compaction is still the wrong lever to reach for first. Anthropic's own long-running-agent team chose full context resets over summarise-and-continue, and named the failure compaction induces: context anxiety, where a model wraps up prematurely near its perceived limit. A June 2026 paper measured the alternative on a 50-task benchmark: full history scored 71.0% completion on 1,480,996 tokens, pruning to the last five tool interactions scored 79.0% on 535,274 tokens, and pruning plus summarisation scored 91.6% on 553,374 tokens — 20.6 points better on 63% fewer tokens. This guide gives the order the levers go in, the documented parameters for clear_tool_uses_20250919, and the cache interaction nobody writes about: clearing tool results invalidates your cached prefix, so a careless edit costs more than it saves.

U
Uvin Vindula·August 22, 2026
AI & Machine Learning15 min
IAMUVIN

MCP Went Stateless: Migrating Your Server

The Model Context Protocol revision dated 28 July 2026 removes the initialize handshake and the Mcp-Session-Id header, and deprecates the legacy HTTP+SSE transport with a year-long offramp. Most tutorials still teach all three. This is the migration guide instead: what each removed piece is replaced by, what the 12-month deprecation windows mean for a server already carrying production traffic, and the order to do the work in so you do not break clients that have not upgraded. Covers the self-contained request shape and optional server/discover capability discovery, Multi Round-Trip Requests replacing server-initiated calls over open streams, the Mcp-Method and Mcp-Name headers that let a gateway route and meter without parsing your JSON body, cacheable list and read results carrying ttlMs and cacheScope, and the auth hardening that will break integrations quietly — RFC 9207 issuer validation, credential binding, and Dynamic Client Registration deprecated in favour of Client ID Metadata Documents. Ends on the client half of the problem, which is the expensive half: a five-server MCP setup burns roughly 55,000 tokens of tool definitions before the agent does any work, and tool-selection accuracy degrades once you pass 30 to 50 tools. Written by an engineer who ships MCP servers, with every spec claim linked to the primary source.

U
Uvin Vindula·August 12, 2026
AI & Machine Learning12 min
IAMUVIN

MCP Servers: The New Standard for AI Tool Integration

A hands-on guide to building MCP (Model Context Protocol) servers that give AI models access to your tools, databases, and APIs. Covers the full architecture — tools, resources, transport layers — with a complete TypeScript implementation you can deploy today. Based on real MCP servers I've built and use daily through Claude Code. If you're integrating AI into your workflow or building AI-powered products, MCP is the protocol that makes tool use composable, testable, and production-ready.

U
Uvin Vindula·February 10, 2025
AI & Machine Learning10 min
IAMUVIN

LangChain vs Building from Scratch: When to Use a Framework

An honest comparison of LangChain versus building custom AI pipelines from scratch using the Anthropic SDK. After shipping production apps both ways, I break down when LangChain genuinely helps, when it actively hurts, and why most production applications are better served by a thin custom layer over the Anthropic SDK. Includes code comparisons, a decision framework, and the maintenance reality nobody talks about.

U
Uvin Vindula·June 10, 2024
AI & Machine Learning11 min
IAMUVIN

Building an AI Content Generation Pipeline

A practical guide to building production AI content pipelines using Claude API with structured prompts, quality control layers, and human review checkpoints. Covers prompt design for consistent output, template systems, automated quality checks, SEO optimization, cost analysis with real numbers, and honest assessment of when AI content works and when it doesn't. Based on pipelines I've built for clients generating blog posts, product descriptions, and SEO content at scale.

U
Uvin Vindula·June 3, 2024
AI & Machine Learning10 min
IAMUVIN

Vercel AI SDK: Streaming AI Responses in Next.js

A production guide to streaming AI responses in Next.js using the Vercel AI SDK with Claude as the provider. Covers useChat, useCompletion, streamText, tool calling, custom providers, error handling, token counting, and cost control. Based on real implementations where streaming cut perceived latency by 80% and tool calling replaced brittle prompt chains. Includes the exact patterns I use to ship AI features at iamuvin.com and in client projects.

U
Uvin Vindula·May 20, 2024
AI & Machine Learning11 min
IAMUVIN

How to Build a Document Analysis System with Claude

A practical guide to building production document analysis with Claude — from PDF text extraction and vision-based OCR for scanned documents, to structured data extraction for invoices and contracts. Covers chunking strategies for large documents, confidence scoring, and the Next.js API architecture that ties it all together.

U
Uvin Vindula·May 13, 2024
AI & Machine Learning11 min
IAMUVIN

Building AI-Powered Search for E-commerce Applications

How I built AI search systems that understand what customers actually mean — not just what they type. From EuroParts Lanka where customers describe car problems in plain language to FreshMart where shoppers search by recipe instead of ingredient. Semantic search, hybrid ranking, and the architecture that makes it work at production scale.

U
Uvin Vindula·May 6, 2024
AI & Machine Learning9 min
IAMUVIN

The Real Cost of AI Integration in 2026

A transparent breakdown of what AI integration actually costs in 2026 — from API spend and development hours to infrastructure and ongoing maintenance. Based on real projects I've shipped, including the EuroParts Lanka AI Part Finder. No vague estimates. Real numbers from $15K to $50K engagements.

U
Uvin Vindula·April 22, 2024
AI & Machine Learning12 min
IAMUVIN

Implementing Semantic Search in Next.js with Supabase pgvector

A complete implementation guide for building semantic search with pgvector in Supabase. Covers embedding generation, vector storage, hybrid search combining vector and full-text queries, and a production-ready Next.js API route with a React search component. Real code from real projects.

U
Uvin Vindula·April 15, 2024
AI & Machine Learning10 min
IAMUVIN

Vector Databases Explained: Pinecone vs Weaviate vs pgvector

A practical comparison of Pinecone, Weaviate, and pgvector from someone who has shipped production systems on all three. Spoiler: pgvector wins for most teams because it is already in your database.

U
Uvin Vindula·April 8, 2024
AI & Machine Learning11 min
IAMUVIN

Building an AI Chatbot That Actually Works

Most AI chatbots are glorified search bars that hallucinate. Here's how to build one that actually works — with proper context management, streaming responses, conversation memory, and guardrails that prevent your chatbot from confidently lying to customers. Based on real production experience building the EuroParts Lanka AI Part Finder with Claude API, Next.js, and TypeScript. Includes complete code examples, architecture decisions, and a production checklist.

U
Uvin Vindula·April 1, 2024
AI & Machine Learning11 min
IAMUVIN

Prompt Engineering for Production Applications

A practical guide to prompt engineering for production applications, drawn from shipping real AI features with the Claude API. Covers system prompt design, few-shot vs zero-shot patterns, chain-of-thought reasoning, structured JSON output, temperature tuning, and systematic testing. Includes real prompt examples from the EuroParts Lanka AI Part Finder, where natural language descriptions get mapped to exact OEM part numbers for 40,000+ European car parts.

U
Uvin Vindula·March 18, 2024
AI & Machine Learning11 min
IAMUVIN

How I Built the EuroParts Lanka AI Part Finder with Claude

A build log of how I integrated Claude's API into europartslanka.lk to let customers describe car problems in plain English and get back exact OEM part numbers, compatible models, and pricing — serving 966 customers and 1,444 parts delivered.

U
Uvin Vindula·March 11, 2024
AI & Machine Learning11 min
IAMUVIN

Claude API vs OpenAI API: An Honest Comparison for Developers

A developer-first comparison of Claude API and OpenAI API covering pricing, response quality, tool use, streaming, and developer experience — based on months of production usage building real products.

U
Uvin Vindula·March 4, 2024
AI & Machine Learning13 min
IAMUVIN

Multi-Agent AI Systems: Architecture and Implementation

A practical guide to multi-agent AI system architecture — orchestrator, pipeline, and swarm patterns with TypeScript implementation. Based on real experience building IAMUVIN OS, a multi-business command center powered by Claude AI agents.

U
Uvin Vindula·February 19, 2024
AI & Machine Learning13 min
IAMUVIN

RAG Systems Explained: Build Your First Retrieval-Augmented Generation App

A production-focused guide to building retrieval-augmented generation systems with TypeScript, Supabase pgvector, and the Claude API. Real code, real architecture, zero hand-waving.

U
Uvin Vindula·February 12, 2024
AI & Machine Learning14 min
IAMUVIN

Building AI Products with Claude API: The Complete 2026 Guide

A practical guide to building AI products with the Claude API using TypeScript and Next.js. Covers setup, streaming, tool use, error handling, and production deployment. Based on real implementations including the EuroParts Lanka AI Part Finder, where customers describe car problems in plain English and Claude identifies the exact OEM part. Includes cost optimization strategies that reduced API spend by 60% in production.

U
Uvin Vindula·February 5, 2024