Arrange Act Assert

Jag Reehal's thoughts on things, mostly product development

Tag: ai-sdk

4 posts tagged “ai-sdk”.

Local decision models with AI SDK Ollama

01 Oct 2026

Ollama 0.35 runs decision models on your own computer. You give one a support ticket and a question like “which team should handle this?”, and it returns a percentage for each team instead of writing a reply.

ai-sdk-ollama 4.4.0 lets you call them from the AI SDK.

I ran 12 support tickets through the three new models and a small chat model on a MacBook Pro.

The decision models routed every clear ticket correctly.

On the tickets I wanted a person to check, two of the three models still sounded sure, and that changes how you set the rule that hands work to a human.

A support ticket goes to a decision model, which returns a percentage for each team. A rule checks the top percentage: 70% or higher routes the ticket to that team automatically; below 70% sends it to a person.

Read More →

Reranking: Improving Search Relevance with the AI SDK

23 Dec 2025

Reranking improves search relevance by reordering documents based on their relevance to a query. Unlike embedding-based similarity search, reranking models are specifically trained to understand the relationship between queries and documents, often producing more accurate relevance scores.

Reranking

Read More →

Agent: The Sugar Syntax of streamText

19 Sep 2025

For most of us, AI still feels like a black box. We send it a prompt and we get back a blob of text. Maybe we write some code to call a tool; maybe we juggle a few callbacks. We tell ourselves that this is just how things work: a model can only generate tokens, and tools can only run in our code.

But what if this mental model is the problem?

In this post I want to argue that the Agent pattern in the AI SDK is as revolutionary for AI development as useState and useEffect were for React. Just like React’s client/server directives annotate where code runs across the network, the Agent API annotates where logic runs across the AI/model boundary.

Agent

Read More →

Build Safer, Faster, and More Reliable AI Apps with AI SDK Middleware

27 Aug 2025

Having recently built an AI Guardrails library for the AI SDK, I wanted to share what I learned along the way. This post will walk you through how you can write your own middleware, and why it’s such a game-changer for building robust AI applications.

Design AI features that are safer, faster, and easier to evolve by layering language model middleware. This guide explains how to use AI SDK middleware to transform inputs, post-process outputs, enforce safety rules, cache results, observe performance, and handle streaming using a clean, composable approach aligned with official guidance.

Read More →