Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
165677 stories
·
33 followers

Introducing DocumentExtractionClient (preview): Extract documents in .NET

1 Share

A lot of the information your apps need lives in documents. Invoices, contracts, reports, forms, and slide decks arrive as PDFs, scans, images, and Office files. Getting their content and structure out is the first step for search, automation, data entry, and archiving. It’s also how AI apps get the context they need. Before a model can answer questions about a document, your app has to turn that document into something the model can work with. Until now, each parser or service came with its own SDK and object model. Moving to another tool meant rewriting the code that used the results.

Today we’re introducing a preview of DocumentExtractionClient in Microsoft.Extensions.DocumentExtraction, along with a set of starter providers in the .NET AI Community Toolkit. Whichever provider you choose, the flow is the same. You load a document, pick a provider, and extract its contents into a common structure. Providers include a PDF parser that runs in process, a vision model behind any IChatClient, and cloud services like Azure Content Understanding.

In this post, you’ll learn what document extraction is, where DocumentExtractionClient fits among the .NET AI building blocks, and how to extract your first document, swap providers, and add middleware. Then you’ll feed the results into a data ingestion pipeline with Microsoft.Extensions.DataIngestion, the foundation for context engineering, agentic workflows, and retrieval-augmented generation (RAG). Every sample is a single C# file you can run with dotnet run. They’re all in the document extraction samples repo.

What is document extraction?

Document extraction turns a file, such as a PDF, a scanned image, or an Office document, into structured content. A document shows text on a page, but the file often doesn’t say what that text is. A heading, a table cell, and a page number can all look like ordinary characters. Extraction recovers that structure, including:

  • Headings and paragraphs, so you know how the document is organized.
  • Tables, as a grid of cells, including merged header cells.
  • Figures, with their position and any description the provider can produce.
  • Sources, the page and region each element came from, so you can cite it or highlight it later.

Getting there is harder than it sounds. Office files and many PDFs store their text digitally, so you can read it directly. Scans and photos are only pictures of pages, so they need optical character recognition (OCR). Tables have merged header cells, pages have running headers and footers, and multi-column layouts confuse a naive reading order. Different tools solve different parts of the problem. Each one returns its results in a different shape.

Structure matters wherever you use the content, especially in AI apps. Models answer better when you give them the right context, and the right context depends on structure. When you chunk a document at its headings, each chunk covers one topic. When you flatten a table into a list of words, the model can no longer tell which number belongs to which row.

Introducing DocumentExtractionClient

DocumentExtractionClient gives you one API for document extraction in .NET, regardless of which tool does the work. Its main method, ExtractAsync, takes a stream and returns an ExtractionDocument. That’s a tree of sections that contain text, tables, and images. Each element has sources that point back to where it came from. Providers implement this abstraction, so your code works with the same result type whether a PDF parser, a vision model, or a cloud service read the document.

If you’ve used IChatClient or IEmbeddingGenerator from Microsoft.Extensions.AI, the pattern will feel familiar, with a common abstraction, interchangeable providers, and middleware you can layer on top.

Where it fits

.NET AI stack by library, from your app and agents down to models, with DocumentExtraction as the read step in context

The .NET AI stack is a set of libraries, organized in layers:

Think of these libraries as building blocks. You compose the ones you need to build rich AI experiences, add capabilities as your app grows, and swap in a different provider or implementation without rewriting the rest of your app. You don’t need the whole stack, either. Document extraction works on its own, with or without AI.

Pick a provider

To help you get started, the .NET AI Community Toolkit includes a set of starter providers. Like DocumentExtractionClient, they’re in preview. PdfPig runs in process. The vision language model runs wherever your IChatClient does, locally or hosted. The rest are hosted services.

Document extraction providers, including PdfPig in process, a vision model on any IChatClient, hosted services, or your own

Provider Package Runs Good for
PdfPig CommunityToolkit.DocumentExtraction.PdfPig In process PDFs that already have a text layer
Vision language model CommunityToolkit.DocumentExtraction.VisionLanguageModel Any IChatClient that accepts images, local or hosted Scans and images, when you can review the output
Azure Content Understanding CommunityToolkit.DocumentExtraction.AzureContentUnderstanding Azure OCR, layout, tables, and figures, plus analyzers you can customize
Azure AI Document Intelligence CommunityToolkit.DocumentExtraction.AzureDocumentIntelligence Azure OCR, layout, tables, and page coordinates
Mistral OCR CommunityToolkit.DocumentExtraction.Mistral Microsoft Foundry or the Mistral API Fast OCR to Markdown

There’s no single best provider, because their capabilities differ. PdfPig is fast, but it reads only PDFs and only the text that’s already in them. A vision model can read scans and images, but you should review its output. A local model can also be slow. Mistral OCR reads PDFs and images. The Azure services also accept formats like Office documents and handle OCR and layout analysis for tables and figures. With any hosted provider, including a hosted vision model, your document leaves your machine. Choose the provider whose capabilities match your documents, and change it later if your needs change.

These providers are a starting point to help bootstrap the ecosystem. If you need a different parser, an internal service, or a model they don’t cover, you can write your own provider. Derive from DocumentExtractionClient and implement ExtractAsync. Your provider works with the same middleware, dependency injection, and data ingestion code as the starter providers. We’d love to see the community build and share providers for more tools and services.

What you’ll need

  • .NET 11 SDK. On Windows, you can install it with winget install Microsoft.DotNet.SDK.11.
  • Optional: Ollama for the vision model and embedding samples.
  • Optional: an Azure subscription and the Azure Developer CLI for the cloud providers.

Don’t want to install anything? Open the samples repo in GitHub Codespaces. The dev container has .NET 11 and an Ollama sidecar with the models already pulled.

The samples use three short intro books I wrote for this post: Tokens, Explained, Tensors in Ten Pages, and Agents Propose, Tools Decide. Each one has headings, running headers and footers, a table with a merged header cell, a figure, and code. That’s enough structure to see how each provider handles a real document. Each book also comes as a scanned copy with no text layer, which you’ll use later in this post.

Extract your first document

Clone the repo:

git clone https://github.com/luisquintanilla/dotnet-document-extraction-samples
cd dotnet-document-extraction-samples

Here’s the first sample, 01-extract.cs. It reads a PDF with PdfPig and prints the outline.

#!/usr/bin/env dotnet
#:package Microsoft.Extensions.DocumentExtraction@11.0.0-preview.1.26560.3
#:package CommunityToolkit.DocumentExtraction.PdfPig@1.0.0-preview
#:property PublishAot=false
#:property NoWarn=$(NoWarn);MEDE0001;EXTEXP0019;CTDE0001

using CommunityToolkit.DocumentExtraction.PdfPig;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DocumentExtraction;
using Microsoft.Extensions.Documents;
using UglyToad.PdfPig.DocumentLayoutAnalysis.PageSegmenter;

string path = args.Length > 0 ? args[0] : Path.Combine("books", "pdf", "tokens-explained.pdf");

// PdfPig reads the PDF text layer. Docstrum groups words into paragraph-sized blocks,
// and the role callback marks large text as a heading. Both are local heuristics.
using DocumentExtractionClient extractor = new PdfPigDocumentExtractionClient(
    pageSegmenter: DocstrumBoundingBoxes.Instance,
    roleResolver: block => block.TextLines[0].Words[0].Letters[0].PointSize >= 13 ? "heading" : null);

await using var input = File.OpenRead(path);
ExtractionDocument document = await extractor.ExtractAsync(input, Path.GetFileName(path), "application/pdf");

Console.WriteLine($"{document.Identifier}: {document.Sections.Count} sections");
Console.WriteLine();

foreach (var section in document.Sections)
{
    int? page = section.Sources.FirstOrDefault()?.Page.PageNumber;
    Console.WriteLine($"Section (page {page?.ToString() ?? "?"}), {section.Elements.Count} elements");

    foreach (var element in section.Elements)
    {
        string text = element.Content is TextContent t ? t.Text.ReplaceLineEndings(" ") : "";
        if (text.Length > 70) text = text[..67] + "...";

        string kind = element switch
        {
            ExtractionDocumentTextElement { HeadingLevel: { } level } => $"heading {level}",
            ExtractionDocumentTextElement e => e.Role ?? "text",
            ExtractionDocumentTableElement table => $"table {table.Cells.RowCount}x{table.Cells.ColumnCount}",
            ExtractionDocumentImageElement => "image",
            _ => element.GetType().Name,
        };
        Console.WriteLine($"  [{kind}] {text}");
    }
}

Run the app

dotnet run 01-extract.cs

You’ll see one section per page. Here’s the start of the output:

tokens-explained.pdf: 5 sections

Section (page 1), 5 elements
  [heading] Tokens, Explained
  [heading] A short introduction to tokenization in .NET By Luis Quintanilla In...
  [text] What a token is, and why models read tokens instead of words The to...
  [text] Before you start. All examples use the Microsoft.ML.Tokenizers NuGe...
  [text] Page 1 of 5
Section (page 2), 14 elements
  [text] Tokens, Explained
  [text] Sample book for document extraction
  [heading] What is a token?
  [text] A language model never sees your text directly. Before the model ru...
  ...

How it works

DocumentExtractionClient is the abstraction every provider derives from, so the rest of your code depends only on it. You call ExtractAsync with a stream, an identifier such as the file name, and a media type, and you get back an ExtractionDocument.

That result is a tree. An ExtractionDocument has Sections, and each section has Elements such as text, tables, and images. Text elements can carry a heading level or a role like pageHeader, and every element can carry Sources that point back to the page it came from.

A PDF text layer records where letters are on the page but not what they mean. So the sample tells PdfPig how to group words into blocks and which text to treat as a heading (anything 13 points or larger). You can see that heuristic misfire in the output above, where the subtitle and byline are tagged as a heading. It’s a reasonable first pass. When you need more structure, you can swap providers.

Swap providers without changing your code

The second sample, 02-swap-providers.cs, picks a provider by name, and everything after that line is the same for every provider:

using DocumentExtractionClient? extractor = Providers.Create(provider, out string? skipped);

// From here down, nothing knows or cares which provider is running.
ExtractionDocument document = await Samples.ExtractFileAsync(extractor, path);
Samples.PrintOutline(document);

Providers.Create lives in common/Providers.cs. Here’s how it creates each provider. The Azure providers sign in with DefaultAzureCredential, so there are no keys in the code.

// Azure Content Understanding
DocumentExtractionClient contentUnderstanding = new ContentUnderstandingClient(new Uri(endpoint), new DefaultAzureCredential())
    .AsDocumentExtractionClient(new() { AnalyzerId = "prebuilt-layout" });

// Azure AI Document Intelligence
DocumentExtractionClient docIntel = new DocumentIntelligenceClient(new Uri(endpoint), new DefaultAzureCredential())
    .AsDocumentExtractionClient(new() { DefaultModel = "prebuilt-layout" });

// Mistral OCR in Microsoft Foundry
DocumentExtractionClient mistral = new MistralDocumentExtractionClient(
    new MistralDocumentExtractionClientOptions
    {
        OcrEndpoint = new Uri(mistralUri),
        DefaultModel = "mistral-ocr-4-0",
        TokenScope = "https://cognitiveservices.azure.com/.default",
    },
    new DefaultAzureCredential());

// A vision language model, using any IChatClient. Here, Ollama.
IChatClient chat = new OllamaApiClient(new Uri("http://localhost:11434"), "qwen3.5:4b");
DocumentExtractionClient vision = new VisionLanguageModelDocumentExtractionClient(
    chat, new() { UseStructuredOutput = true });

The vision model provider takes any IChatClient that accepts images, so you can use a local or a hosted model. This sample uses a local model through Ollama, which accepts images but not PDFs. So Providers.cs renders each PDF page as an image before sending it to the model.

Samples 02 through 04 all read the same page, page 3 of Tokens, Explained (books/pages/tokens-explained-hero.pdf), because it has a bit of everything, including running headers, a heading, a table with merged cells, a figure, and code. Here it is, labeled with the roles that a service like Azure Content Understanding might return for each part:

Page 3 of Tokens, Explained labeled with header, heading, text, table, image, and page number roles

Now run that page through a few providers:

dotnet run 02-swap-providers.cs -- pdfpig
dotnet run 02-swap-providers.cs -- cu
dotnet run 02-swap-providers.cs -- ollama

Here’s what came back:

PdfPig (local, text layer) took 0.4s
  p1 [text] Tokens, Explained
  p1 [text] Sample book for document extraction
  p1 [heading] Tokenizers in .NET
  p1 [text] The Microsoft.ML.Tokenizers library brings popular model tokenizers...
  p1 [text] Tokenizer
  p1 [text] Algorithm
  p1 [text] .NET type
  ... 23 more lines, one per table cell ...

Azure Content Understanding took 10.2s
  p1 [pageHeader] Tokens, Explained
  p1 [pageHeader] Sample book for document extraction
  p1 [heading] Tokenizers in .NET
  p1 [text] The Microsoft. ML. Tokenizers library brings popular model tokenize...
  p1 [table 6x5]
  p1 [image]
  ...
  p1 [pageNumber] Page 3 of 5

Vision language model (Ollama) took 23.6s
  p1 [text] # Tokens, Explained  Sample book for document extraction  ## Tokeni...
  p1 [table 6x5]
  p1 [image]

The same extraction code produces different results because each provider handles extraction differently. PdfPig was fastest, but it returned the table as loose lines of text. Content Understanding recognized the table, the figure, and the running headers, and labeled each one with a role. The vision model also found the table, and it returned the text as Markdown.

The third sample, 03-compare.cs, runs every provider you’ve configured on the same page and writes a side-by-side report:

pdfpig      0.4s  1 headings, 34 text, 0 tables, 0 images
ollama     26.9s  0 headings, 1 text, 1 tables, 1 images
mistral    10.2s  0 headings, 2 text, 0 tables, 1 images
docintel   13.0s  2 headings, 9 text, 1 tables, 1 images
cu         10.4s  1 headings, 10 text, 1 tables, 1 images

Even the two Azure services differ here. Document Intelligence tagged both headings on the page, while Content Understanding returned the second one as plain text. These timings come from my machine and the cloud services I provisioned, so yours might vary depending on your setup. The shape of the results is what matters, so try a few providers on your own documents before you choose one.

Work with the results

Walk the whole tree

An ExtractionDocument is a tree by design. document.Sections holds the root sections, and a section’s Elements can include nested sections as well as content. How deeply sections nest depends on the provider. PdfPig returns one section per page, while layout-aware providers like Content Understanding and Document Intelligence map the document’s own hierarchy into nested sections. On the sample page, a loop over document.Sections and their Elements reaches only 4 of the 13 content elements that Content Understanding returns.

Content Understanding result tree where a two-level loop reaches 4 of 13 elements and EnumerateContent reaches all 13

To reach all of the content, use EnumerateContent(), which walks the tree depth-first in document order and returns every element that isn’t a section:

foreach (var table in document.EnumerateContent().OfType<ExtractionDocumentTableElement>())
{
    Console.WriteLine($"Table: {table.Cells.RowCount} rows x {table.Cells.ColumnCount} columns");
}

Read tables cell by cell

Tables are a grid in which each cell knows its row, its column, and how many rows and columns it spans. A merged cell appears once, at its top-left position. The fourth sample, 04-tables-and-sources.cs, prints every cell:

foreach (var cell in table.Cells)
{
    if (cell is null) continue; // an empty position in the grid

    string span = (cell.RowSpan, cell.ColumnSpan) switch
    {
        (1, 1) => "",
        var (rows, cols) => $" spans {rows}x{cols}",
    };
    string role = cell.Role is null ? "" : $" ({cell.Role})";
    Console.WriteLine($"  [{cell.RowIndex},{cell.ColumnIndex}]{span}{role} {Samples.TextOf(cell.Content)}");
}

Here’s the start of the table from Content Understanding (dotnet run 04-tables-and-sources.cs -- cu). It found the merged header cells and marked them as column headers:

Table: 6 rows x 5 columns
  [0,0] spans 2x1 (columnHeader) Tokenizer
  [0,1] spans 2x1 (columnHeader) Algorithm
  [0,2] spans 2x1 (columnHeader) .NET type
  [0,3] spans 1x2 (columnHeader) Where you'll see it
  [1,3] (columnHeader) Model families
  [1,4] (columnHeader) Typical use
  [2,0] (content) Tiktoken
  [2,1] (content) Optimized BPE
  [2,2] (content) TiktokenTokenizer
  ...

The vision model also got every cell’s text right, but it didn’t report the spans. Differences like that matter when you turn a table back into Markdown for a model to read.

Know where things came from

Each element has Sources. A source points to a page and, when the provider knows it, a polygon around the element on that page:

"Tokenizers in .NET"
  page 1, Inch: (0.79,0.81) (2.95,0.81) (2.95,1.06) (0.79,1.06)

That’s what you need to show a citation or highlight the paragraph an answer came from.

Add logging and middleware

Because every provider is a DocumentExtractionClient, you can wrap any of them with middleware, the same way you do with IChatClient. Register a client in dependency injection, then layer behavior on top:

services.AddKeyedDocumentExtractionClient("documents", sp => new PdfPigDocumentExtractionClient())
    .UseLogging()
    .Use((inner, sp) => new ScannedPdfFallback(inner, sp.GetRequiredKeyedService<DocumentExtractionClient>("ocr")));

To write your own middleware, derive from DelegatingDocumentExtractionClient and override ExtractAsync. Providers have different capabilities, and documents have different needs. A PDF with a text layer only needs PdfPig, a scan needs OCR, and a page full of tables benefits from layout analysis. The fallback in 05-pipeline.cs tries PdfPig first. If the PDF comes back with almost no text, it treats the file as a scan and sends the same bytes to an OCR provider instead.

Flow where PdfPig reads PDFs with a text layer and a scanned PDF falls back to Content Understanding for OCR

sealed class ScannedPdfFallback(DocumentExtractionClient inner, DocumentExtractionClient ocr) : DelegatingDocumentExtractionClient(inner)
{
    public override async Task<ExtractionDocument> ExtractAsync(Stream stream, string identifier, string mediaType,
        DocumentExtractionOptions? options = null, CancellationToken cancellationToken = default)
    {
        // Buffer the input so it can be read twice.
        using var buffer = new MemoryStream();
        await stream.CopyToAsync(buffer, cancellationToken);
        buffer.Position = 0;

        var document = await base.ExtractAsync(buffer, identifier, mediaType, options, cancellationToken);
        int characters = document.EnumerateContent().Sum(e => e.Content is TextContent t ? t.Text.Trim().Length : 0);
        if (characters > 100)
        {
            return document;
        }

        Console.WriteLine($"   No text layer in {identifier} ({characters} characters). Falling back to OCR.");
        buffer.Position = 0;
        return await ocr.ExtractAsync(buffer, identifier, mediaType, options, cancellationToken);
    }
}

Here it is on the regular book and on its scanned copy, with Content Understanding as the OCR provider:

== tokens-explained.pdf
   pdfpig read tokens-explained.pdf in 1.1s
   5 sections, about 739 words

== tokens-explained-scanned.pdf
   pdfpig read tokens-explained-scanned.pdf in 0.0s
   No text layer in tokens-explained-scanned.pdf (0 characters). Falling back to OCR.
   cu read tokens-explained-scanned.pdf in 13.1s
   5 sections, about 767 words

The app asked for a document and got one, without needing to know that the second file was a scan. The same pattern works for any capability. You can route documents with tables to a layout-aware provider or images to a vision model, and the rest of your code stays the same.

Feed a data ingestion pipeline

Last year we introduced data ingestion building blocks for .NET. Microsoft.Extensions.DataIngestion gives you a pipeline that reads documents, splits them into chunks, and writes them to a vector store. Document extraction fits in at the start. What you ingest becomes context you can use in many ways. You can ground answers in a RAG app, engineer the context you give a model, or give an agent knowledge to search with a tool.

The sixth sample, 06-ingest.cs, shows the RAG case. It extracts the three books, chunks them at their headings, embeds the chunks with an embedding model, and searches them:

Pipeline that extracts, chunks, embeds, and stores three books, then answers a question with matching sections

// Any DocumentExtractionClient works here. This one uses Azure Content Understanding.
DocumentExtractionClient extractor = new ContentUnderstandingClient(new Uri(endpoint), new DefaultAzureCredential())
    .AsDocumentExtractionClient(new() { AnalyzerId = "prebuilt-layout" });

IngestionDocumentReader reader = new ExtractionReader(extractor);

var tokenizer = TiktokenTokenizer.CreateForModel("gpt-4o");
IngestionChunker<string> chunker = new HeaderChunker(new IngestionChunkerOptions(tokenizer)
{
    MaxTokensPerChunk = 256,
    OverlapTokens = 32,
});

IEmbeddingGenerator<string, Embedding<float>> embeddings =
    new OllamaApiClient(new Uri("http://localhost:11434"), "embeddinggemma");
using var store = new InMemoryVectorStore(new() { EmbeddingGenerator = embeddings });
using var writer = new VectorStoreWriter<string>(store, dimensionCount: 768);

using var pipeline = new IngestionPipeline<string>(reader, chunker, writer);
await foreach (var result in pipeline.ProcessAsync(books))
{
    Console.WriteLine($"Ingested {Path.GetFileName(result.DocumentId)}: {(result.Succeeded ? "ok" : result.Exception?.Message)}");
}

The pipeline reads documents through an IngestionDocumentReader, so the sample includes its own reader, ExtractionReader, for convenience. It calls ExtractAsync and maps the resulting ExtractionDocument to the IngestionDocument the pipeline chunks:

sealed class ExtractionReader(DocumentExtractionClient client) : IngestionDocumentReader
{
    public override async Task<IngestionDocument> ReadAsync(Stream source, string identifier, string mediaType,
        CancellationToken cancellationToken = default)
    {
        var extracted = await client.ExtractAsync(source, identifier, mediaType, cancellationToken: cancellationToken);
        var document = new IngestionDocument(identifier);
        // Map each section's headings, paragraphs, and tables to ingestion elements.
        ...
        return document;
    }
}

It walks every nested section, keeps headings as headings, and turns tables into Markdown. It skips running headers and page numbers, which only add noise to chunks. For now, if you’re combining the two in your own apps, you can copy the full reader from the sample. We intend to make composing document extraction and data ingestion simpler in upcoming releases.

Run it with Content Understanding and ask a question:

dotnet run 06-ingest.cs -- cu "How do I count tokens before calling a model?"
Ingested agents-propose-tools-decide.pdf: ok
Ingested tensors-in-ten-pages.pdf: ok
Ingested tokens-explained.pdf: ok

Q: How do I count tokens before calling a model?

[0.60] tokens-explained.pdf | Plan your budget
   Plan your budget Think of the context window as a budget you split between the parts of your
   prompt. ... | Part of the request | Example tokens | | --- | --- | | System prompt | 1,000 | ...

[0.60] tokens-explained.pdf | Three things to remember
   Three things to remember . A token is not a word. A token often includes its leading space...

[0.55] tokens-explained.pdf | Counting tokens and staying in budget
   Counting tokens and staying in budget Every model has a context window, the maximum number...

Each result knows which section it came from, because extraction found the headings and the chunker split there. The top result even includes the budget table as Markdown. Good structure gives you chunks that each cover one topic, with enough context to be useful.

Next steps

We’re excited to see what you build. Here’s where to go next:

We want to hear from you. Share your feedback, ideas, and suggestions, and let us know if something doesn’t work as expected. For DocumentExtractionClient itself, open an issue in dotnet/extensions. For a specific provider, open an issue in the .NET AI Community Toolkit.

The post Introducing DocumentExtractionClient (preview): Extract documents in .NET appeared first on .NET Blog.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Fixing “No agents connected” in the .NET MAUI DevFlow Inspector

1 Share
A .NET MAUI app on an Android emulator connected to its DevFlow agent, with a broken connection to the broker and the text No agents connected but the agent responds

DevFlow is a set of developer tools for connecting to and inspecting a running .NET MAUI app through the CLI and browser-based Inspector. I love it because it gives agents a way to run, navigate, interact with, and validate the app while it is running, making it much easier to debug and understand what is happening on an emulator or device.

I hit a really confusing one with the .NET MAUI DevFlow Inspector: the page says No agents connected, but maui devflow agent status happily talks to my app. Both can't be true, right? Turns out they can, because they are two different connections. Here is the quick fix, then why it works.

On my Mac (zsh, Android emulator, .NET 10 MAUI app), restarting the broker with IPv6 disabled brought everything back:

maui devflow broker stop
DOTNET_SYSTEM_NET_DISABLEIPV6=1 maui devflow broker start --foreground

Leave that terminal open, and in another one run:

maui devflow wait --timeout 30
maui devflow list

The app showed up right away, and I didn't even have to restart it. Keep in mind this is a workaround that worked for me, not an official fix. I filed it as dotnet/maui-labs#851, and I haven't confirmed that every Mac hits it.

The agent is fine, the broker never heard about it

DevFlow has two pieces that are easy to blur together:

  • The agent lives inside your app and runs its own HTTP server.
  • The broker is a small background daemon that keeps a registry of running agents so the CLI and Inspector can find them.

The DevFlow docs and broker docs cover the architecture. The part that matters here is that the CLI can talk to an agent directly, without the broker, if you tell it where to look:

maui devflow agent status --agent-host localhost --agent-port 9223

That worked for me, but it only proves the CLI can reach the agent. It says nothing about whether the app registered with the broker. Meanwhile maui devflow list returned [], which means the registry was empty.

One note on ports: 9223 was my agent's port (it comes from the .mauidevflow file in my project). The broker normally hands out ports from a pool, so yours can be different. Use the port your agent is actually on.

Check your Android tunnels, but don't stop there

An Android emulator lives on its own network, so two tunnels are involved, and they go in opposite directions:

adb -s emulator-5554 reverse tcp:19223 tcp:19223   # app -> broker on your Mac
adb -s emulator-5554 forward tcp:9223 tcp:9223     # CLI on your Mac -> agent in the app

The Android setup page shows adb reverse for both ports. forward for the agent is what worked for me. The one mistake to avoid is mapping the broker port the wrong way, because that can block the broker from starting.

I set both tunnels up, restarted the app, and recreated the tunnels. Still []. ADB wasn't the problem, so it was time to poke at the broker itself.

The curl trick

The broker listens on port 19223. I asked it for its agent list three different ways:

curl -4 -H 'Host: localhost:19223' http://127.0.0.1:19223/api/agents
curl -6 -H 'Host: localhost:19223' 'http://[::1]:19223/api/agents'
curl -4 http://127.0.0.1:19223/api/agents
Connection Host header Result
IPv4 localhost:19223 404
IPv6 localhost:19223 200
IPv4 127.0.0.1:19223 200

Same broker, same request, different answer depending on the address family and the Host header. My read (and it is only a read, I haven't pinned down the root cause) is that the agent registers through localhost:19223, so a broker that answers that with a 404 never learns the app exists.

Starting the broker with the official .NET DOTNET_SYSTEM_NET_DISABLEIPV6 switch made the IPv4 localhost request work, and the app registered on its own.

Make it stick

Typing the variable every time gets old fast. Instead of turning IPv6 off for every .NET app, I scope it to the maui command.

zsh

Add this to ~/.zshrc:

maui() {
    DOTNET_SYSTEM_NET_DISABLEIPV6=1 command maui "$@"
}

Run source ~/.zshrc or open a new terminal, then run maui devflow broker stop once. The next broker that maui starts should pick up the variable. This does not start the broker, emulator, or app for you.

PowerShell

Same idea in a PowerShell profile (New-Item -ItemType File -Force -Path $PROFILE then code $PROFILE):

function maui {
    $env:DOTNET_SYSTEM_NET_DISABLEIPV6 = "1"
    try { & (Get-Command maui -CommandType Application).Source @args }
    finally { Remove-Item Env:DOTNET_SYSTEM_NET_DISABLEIPV6 -ErrorAction SilentlyContinue }
}

Reload with . $PROFILE. I only tried this in PowerShell 7 on my Mac, and I haven't seen this problem on Windows, so don't assume you need it there.

Startup checklist

  1. The app calls AddMauiDevFlowAgent() in a Debug build.
  2. The emulator is running (adb devices shows it, for example emulator-5554).
  3. adb reverse tcp:19223 tcp:19223 is set for the broker.
  4. adb forward tcp:<your agent port> tcp:<your agent port> is set (mine was 9223).
  5. The broker is running, with IPv6 disabled if you are hitting this.
  6. Run maui devflow wait --timeout 30, then maui devflow list.
  7. Still stuck? Try maui devflow diagnose --device emulator-5554.

There you go! If you are seeing the same thing, add your details to dotnet/maui-labs#851. The more repros the better.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Choose the right stack for your AI application

1 Share

When you’re building software, choosing the technology stack is often the first decision you make—and it can be the hardest. Which language will you use? Where will you store the data? How will you host the application? 

Once you start building LLM-based applications and agents, you have even more decisions to make. Which model(s) will you use? Where will you host those models? And how easy will it be to change models, in this era when new models drop every week? 

If ask around, you’ll hear everyone touting their favorite agent framework—like LangChain or the Microsoft Agent Framework—or maybe you’re hearing about open-source agent harnesses like Pi, Hermes, or OpenClaw. Those are all amazing offerings, and you should use them if they fit the bill, but you may not actually need the complexity of a framework—and you may find yourself fighting a framework if it doesn’t fit your scenario. 

Your goal should be to find the lowest abstraction that lets you build your application, switch models, and be able to take advantage of each model’s best features. In this post, we’ll walk through the ladder of abstractions you can choose from and discuss when you might go for each.

Choosing the model 

Let’s start with model choice—even though this is something you can easily change later, depending on what you layer on top. It helps to have an idea of what models are your current top picks. Are you hoping to use the latest frontier models, with the most parameters possible? Or is your application viable with a lower cost SLM? 

Knowing which model is the best for a job is hard—impossible, really, especially before you have any code written. Model releases typically include their performances on industry-standard benchmarks. For example, the MAI-Code-1-Flash model card shows a 71.6% pass rate on SWE-Bench Verified. Benchmarks aren’t perfect though—they don’t represent all the messy real-world tasks that we want to accomplish with LLMs. Plus, the longer a benchmark has existed, the more likely it is that the LLM’s training data includes the benchmark data itself. 

Leaderboards are another way to measure model performance. ArtificialAnalysis is a website that tracks metrics like intelligence, speed, and cost per task. You can also find more specific task-specific performance on Arena.ai, like their “Text Arena” and “Agent Arena.” Microsoft Foundry also includes our own leaderboards, plus the ability to make trade-off charts for the specific models and metrics you care about.

No matter which model you choose as your starting point, it’s just that: a starting point. You’ll need to combine prompt engineering and context engineering to get the very best out of that model, incorporating evaluation and optimization into your pipeline and stack.  

Model provider 

Once you have your model candidates in mind, your next task is to pick a model provider. For the large models, you’ll need to use a cloud provider. For smaller models, you may choose to run them locally, run them on rented GPUs (like Azure serverless GPUs), or run them via a cloud provider. Your best bet is to pick a cloud provider that gives you flexibility and consumption-based pricing. 

At Microsoft, we’re a big believer in model choice. We know that the “best” model changes on a weekly basis these days, and we want to make it easy for developers to be able to change models without changing their model provider. Our Foundry catalog includes 11,000+ models from OpenAI, Anthropic, DeepSeek, Mistral, hosted models from Fireworks AI, open-source models from Hugging Face, and more. You can deploy the most popular models as serverless options with purely token-based pricing. For the more niche models, you’ll pay hourly for the GPUs needed to run the inference. 

Calling the model 

Once you have a model and provider, you’ll also have an HTTP endpoint and a credential. How will you call that model? This is where you start to make the choices that affect your code. You can directly call the HTTP APIs from any language you want, use the official vendor libraries, or use third-party libraries like agent frameworks that have more batteries included. These are all completely valid options, with their own benefits and drawbacks.

Model HTTP API 

Let’s walk through three of the HTTP APIs that you’re likely to use, especially if you’re working with Foundry models: OpenAI Chat Completions API, OpenAI Responses API, and Anthropic Messages API. 

OpenAI Chat Completions API 

OpenAI released the Chat Completions API in 2021, and it quickly became a de facto standard across the industry for more than just OpenAI models. It’s supported on Foundry for all the OpenAI models, and it’s also supported by Ollama and Foundry Local for all their local models.  

OpenAI provides official packages for its APIs in multiple languages. For example, this is how we can use the Python openai package to connect to a Foundry models endpoint:

from openai import OpenAI client = OpenAI( base_url="https://YOUR-ACCOUNT.services.ai.azure.com/openai/v1", api_key="YOUR-API-KEY-HERE" )

That code passes in an API key, but for production, keyless credentials are recommended. 

A chat completion call takes in a model and a list of messages with roles and content:

client.chat.completions.create( model="gpt-5.5", messages=[{"role": "user", "content": ”Hello"}])

The Chat Completions API is likely the one that the majority of developers are familiar with, but it’s not the API that new capabilities are being built for anymore. OpenAI now recommends Responses API for all new projects, and that’s where the newer features show up—none of which are available on Chat Completions. So if you’re starting something new, you should start on Responses. If you already have Chat Completions code, we recommend moving it across, so you don’t get left behind on the features you’ll want later. Use our agent skill for a streamlined migration. 

OpenAI Responses API 

OpenAI released this API along with the GPT-5 model in August 2025 and documented a vendor-neutral version of the API in the  Open Responses specification. The Responses API is supported on Foundry for all Foundry Direct models, excluding those from Anthropic, and it’s also supported by Ollama and Foundry Local. 

The Responses API is similar to Chat Completions, but it has better support for multimodal and tool calling scenarios. It also includes built-in tools that are run on the server side, like code interpreter, and makes it very easy to enable them. This snippet uses that same Python package:

response = client.responses.create( model="gpt-5.5", reasoning_effort="medium", tools=[ {"type": "code_interpreter", "container": {"type": "auto"}}], input="Solve 3x + 11 = 14." )

The Responses API includes optional statefulness for conversations: you can opt to have them stored on the server and continue a conversation based purely on the response ID. It also offers multiple prompt caching options: both automatic and explicit.  

If you’re using an OpenAI GPT-5 family model, you’ll definitely want to use Responses API to get the best reasoning performance out of those models. However, the Responses API is also a good fit for other Foundry Direct models you may be using, like DeepSeek-V4-Flash or Kimi K2.7. 

Anthropic Messages API 

Anthropic has its own HTTP API, tuned for best performance with its models: the Messages API. 

At first glance, the Messages API looks similar. Here’s code using the Python anthropic package:

import anthropic client = anthropic.Anthropic( base_url="https://YOUR-ACCOUNT.services.ai.azure.com/anthropic", api_key="YOUR-API-KEY-HERE" ) response = client.messages.create( model="claude-opus-4-8", max_tokens=4096, thinking={"type": "adaptive"}, messages=[{ "role": "user", "content": "Solve 3x + 11 = 14.", }], tools=[{ "type": "code_execution_20250825", "name": "code_execution"}], )

But there are definite differences—and many model-specific features that the Messages API unlocks for Claude models. The Messages API is stateless only, so you always replay messages in a conversation. However, it also includes cache controls, making it easy to cache previously seen messages. The Messages API allows for many different kinds of thinking controls (like “adaptive” above) and more fine-grained token budgets. Our favorite feature is the built-in support for citations. If you need the LLM to cite its sources, you can provide the source text in a structured list, and the LLM will send back a list of the actual sources used.

LLM-agnostic libraries 

If you truly want to get the best performance out of a model, especially OpenAI and Anthropic models, you should use the model-specific APIs. 

But you might value the ability to swap a model higher than the ability to squeeze every last feature out of it. 

In that case, you’ll want a model-agnostic layer. Your first potential option is the Responses API, since it’s supported for the non-Anthropic models on Foundry, plus supported by other model hosts like Foundry Local, Ollama, vLLM, etc. As soon as you want to use Anthropic or non-Foundry models, you’ll need an option that’s got even wider support for the many models and providers out there. You could write your own abstraction to swap between models, but you can also bring in open-source abstractions that take care of that for you. 

In the Python ecosystem, a popular option is litellm, a package that provides an OpenAI-style interface across 100+ models and providers. After setting endpoints and keys in environment variables, you write code like this:

from litellm import completion response = completion( model="azure/gpt-5.5", # can also be anthropic/claude-4.6, etc. messages=[{"role": "user", "content": "Hello, how are you?"}] )

Behind the scenes, litellm translates your call to the provider-specific APIs, turning it into a Responses API call for OpenAI models or a Messages API call for Anthropic models. Similar packages are lm15, available in multiple languages, and any-llm. 

A cross-model library is a great fit if you want to easily swap models and providers with minimal code change, but it will make it much harder to use model-specific features. It might not make it impossible, as you can often find ways to customize options for your needs, but you may find it more painful to use than the official vendor libraries—and you may end up writing just as much code in that case.  

Model routers 

Another approach is a model router, which routes to models based on task type or complexity, with a configured set of allowed models, automatic retry mechanisms, and fallback policies. A router can come in the form of a package, like litellm, which includes routing logic, or a hosted router gateway, like OpenRouter or the model router for Foundry. 

For example, this is the configuration for a two-model router on Foundry that can switch between either an OpenAI GPT-5.6 Sol model or a Meta Llama 4 Maverick model, depending on task complexity:

{ "sku": { "name": "GlobalStandard", "capacity": 10 }, "properties": { "model": { "format": "OpenAI", "name": "model-router", "version": "2025-11-18" }, "routing": { "mode": "balanced", "models": [{ "format": "OpenAI", "name": "gpt-5.6-sol", "version": "2026-07-09" }, { "format": "Meta", "name": "Llama-4-Maverick-17B-128E-Instruct-FP8", "version": "1" }] } } }

Like many routers, the Foundry router provides routing strategies like the “balanced” option chosen above, which optimizes cost while maintaining quality. We can also choose to optimize more for quality or more for cost, depending on our project needs. 

A model router is a good fit for scenarios where cost optimization is a priority and the project is compatible with multiple models. However, you lose the ability to fine-tune a project for a specific model or to use model-specific customizations.  

Moving beyond single calls 

All of our example code snippets so far have shown single LLM calls: the simplest scenario for an AI-based application. It would be great if we could accomplish all tasks with a single LLM call, as they’re the most deterministic, which in turn makes them the easiest to evaluate and optimize.

But that’s not always the case! Sometimes we need a full agent, an LLM that calls tools in a loop until the goal is reached. Some goals require just one tool call, others may require 200, so there is huge variability in the performance of an agent.

Alternatively, we might instead need a workflow: a chained sequence of steps where the output from one LLM is fed to the input of another LLM call. 

Both workflows and agents often require checkpointing, so that long processes can be resumed, and human-in-the-loop steps where the process is paused until a human gives it approval to continue.

Agent frameworks 

That’s when we turn to agent frameworks. Yes, you could write your own tool-calling and workflow orchestration code yourself, but do you really want to? It’s a fun learning exercise, but you’ll soon discover there’s a surprising amount of complexity in properly handling the output from LLMs—especially once you bring in multimodal and streaming scenarios. 

All agent frameworks provide tool calling loops, state management, error handling, and retries. They also often include workflow orchestration, memory, context management (like compaction), human-in-the-loop mechanisms, and support for multiple model providers. In fact, you may choose an agent framework purely for the ability to swap models at first, even when you’re not building a true agent. 

In that case, you need to choose an agent framework. In the Python ecosystem, we’re fortunate to have many fantastic options—but that also means we have way more to pick from! Here are the three that we personally use the most: 

Microsoft Agent Framework 

This is a relatively new framework that was created by merging the best of Semantic Kernel and Autogen together in a carefully designed library. We recommend it to Azure-native developers since it has the tightest integrations with the Microsoft ecosystem. 

A basic agent looks like this: 

agent = Agent(client=client, instructions="You plan activities.", tools=[get_weather, get_activities]) response = await agent.run("what can I do this weekend in SF?")

Langchain v1 

Many developers know LangChain, since it was the first big LLM package for Python, but most developers know LangChain v0, which was built around the concept of chaining. The LangChain v1 package was re-built from their learnings, and it’s entirely agent-centric. It’s built on top of LangGraph, which is a great option if you’re building a non-agent workflow. 

The LangChain v1 basic agent looks very similar:

agent = create_agent(model=model, system_prompt="You plan activities.", tools=[get_weather, get_activities]) response = agent.invoke({"messages": [{"role": "user", "content": "What can I do this weekend in SF?"}]})

Pydantic AI 

Pydantic AI is an agent framework from the creators of Pydantic, the library that many Python developers use for type-safe data classes. Pydantic AI emphasizes type safety and open standards generally, with full support for OpenTelemetry, A2A, MCP, and more.  

The Pydantic AI agent also looks similar:

agent = Agent(model, system_prompt="You plan activities.", tools=[get_weather, get_activities],) response = await agent.run( "what can I do this weekend in SF?")

Differences between frameworks 

When you look at the code above, you might wonder: are all three frameworks actually giving you the same functionality? They’re definitely giving you a very similar interface: you create an agent by providing a system prompt, tools, and user input. There are definite differences between the frameworks, though, which you’ll see as you make your domain-specific applications.  

Those three frameworks both provide a lot of “batteries included,” but also a high degree of flexibility, thanks to their support for customer middleware. For example, if the framework doesn’t process a model response exactly how you’d like it, you can inject your own middleware to intercept that part of the flow. Whenever you’re choosing a framework, you need to inspect that framework for its extendibility. Assume that you will need to push it past its default behavior at some point. When that happens, will you have to strip out the framework entirely, or is the framework flexible enough to allow customization? 

Choose the right level of abstraction 

We’ve now walked the whole ladder, and it turns out it isn’t really a ladder at all. The first question isn’t how much abstraction we want—it’s whether we need an agentic loop at all: does the model get to pick which tools to call, in what order, and when the work is done? 

When it doesn’t need an agentic loop, we already know the steps and can write them down before anything runs. We call the model directly with the OpenAI or Anthropic API, and one or both of those APIs are supported by most other providers, too. We write more code, but we get full control and the newest model features as soon as they ship. LiteLLM or lm15 makes sense if we genuinely need one code path across vendors, though we’ll then be limited to what they have in common. 

When it does need an agentic loop, the next question is where our tools actually run. If everything the model needs is already built in, like code execution or web search, or it sits behind a cloud-hosted MCP server, the same vendor APIs still do the job. We hand over the tool list once and let the provider run the loop for us. With Anthropic, we can also use the MCP API along with the Messages API. 

We move up to an agent framework when that stops being true. Local functions, tools that reach into our own systems, memory we want to shape ourselves, retries and guardrails we need to reason about. That’s what Microsoft Agent Framework, LangChain, and Pydantic AI are for. 

So there’s a best place to start, and it’s the vendor SDK. That’s why it’s on both sides of the diagram. Everything above it is something we add when we have a specific need for it. 

Next steps 

We hope this framing helps you as you choose the stack for your next AI application. If you choose to build on Foundry, check out these resources that can streamline your developer process: 

The post Choose the right stack for your AI application appeared first on Command Line.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Visual Studio November Update – Faster Workflows, Better Reviews

1 Share

Long waits have a way of breaking concentration. Visual Studio now does less repeated work when you open or close large solutions, launch designers and dialogs, and refresh source-control status. In Open Folder, you can also restore MSBuild dependencies without opening a solution first.

The new Copilot Chat is now on by default for eligible accounts. It handles long sessions more smoothly, accepts files dragged directly into a prompt, keeps conversations in their own tabs, and remembers your conversation mode and tool permissions for each session. Copilot also helps when it’s time to review: Change Groups organizes large pull requests into focused groups with summaries and review guidance, so you can see the structure before opening every file. In the CSS editor, color swatches show stylesheet colors as you edit. Get the Visual Studio 2026 Stable Channel and let us know where these changes help you most.

A More Responsive Visual Studio

Visual Studio now does less redundant work when large solutions load and close. Reusing project-directory information when refreshing C++ comment tasks reduced the measured Parse Solution phase by about 20% for Chromium and 9% for Unreal Engine in the PR’s test scenarios. These figures measure that phase only, not total solution-load time. Separately, Visual Studio removes an unused telemetry query during solution opening.

When you close a large solution, Visual Studio no longer rescans every open document for each project and cuts down on repeated file-watch cleanup. Solution Explorer source-control icon refreshes now run in bounded batches, giving the UI time to render in between. Legacy diagnostic providers also do less work when refreshing large Error List result sets.

When you open Add New Item, Visual Studio loads template registrations for the current project family first instead of initializing every registered project type. You keep the same template choices and project-switching behavior. Windows Forms and UWP XAML designers also avoid repeating some setup work. These changes target Windows Forms designer setup overhead, not your form’s initialization code, and UWP XAML designer startup, not every XAML project type.

Add New Item dialog with templates for a .NET console project

Restore MSBuild Dependencies in Open Folder

Working from a folder doesn’t mean you have to open a solution before restoring dependencies. In Open Folder, right-click a supported solution or project file and select Restore to run the MSBuild Restore target through the existing folder build-action workflow.

If the project belongs to a discovered solution, Visual Studio keeps restore in that solution’s targeting context. The command doesn’t apply to CMake or other build providers, and it excludes C++ .vcxproj files.

A More Capable Copilot Chat

Copilot Chat in Visual Studio just got a new engine. Starting with Visual Studio 2026 version 18.12, it runs on the Microsoft Copilot SDK developed by GitHub, the same technology powering GitHub Copilot CLI, the GitHub Copilot app, and VS Code. It’s on by default, and it’s a major upgrade: same models, more tasks solved, new ways to work.

Drag files from Solution Explorer or Windows File Explorer into Chat to attach them to a prompt instead of opening them in the editor. This also addresses a request for drag-and-drop file references. You can use the Test agent to generate tests when Copilot and its testing capability are enabled.

Choose Interactive for request-and-response work or Autopilot to let the agent continue until it considers the task complete. Set Manual or Allow all tool permissions independently. With Autopilot and Manual together, tools not configured for automatic approval are rejected instead of waiting for a prompt. Selecting Allow all shows a warning. Visual Studio saves these modes with each session, and Configure Defaults opens the related Chat settings. These controls address a request to retain MCP and mode settings.

Chat settings for default conversation mode and tool permissions beside the mode menu

The new engine also brings ways of working with Copilot that the previous experience didn’t offer.

Steer it mid-task. You no longer need to wait for Copilot to finish before redirecting it. Type a new instruction and press Enter, and Copilot applies it while it works. Until then, your message shows as Pending, and you can select the X to withdraw it.

See what Copilot actually did. Each step shows its results, not just the attempt. Expand any step to view the output, open it in the editor, or copy the exact command Copilot ran.

Review Pull Requests Faster with Change Groups

Large pull requests can mix features, tests, refactoring, and supporting changes across many files. Change Groups uses GitHub Copilot to organize related changes into focused review units, so you can understand the structure before opening every file.

Each group includes tags, a concise summary, and Review focus guidance. You can reorder groups, track progress across groups and files, move between comments, and review related files together instead of piecing them together from a flat list.

CSS Editing Improvements

Color swatches now appear beside CSS, SCSS, and LESS color values, making it easier to preview stylesheet colors in the editor. Swatches can resolve CSS custom properties, nested var() references and fallbacks, and resolvable SCSS and LESS variables. Select a swatch to see named-color suggestions or open the picker for hex and functional colors.

CSS editor showing color swatches beside custom-property values and a color picker

Updated schema data adds IntelliSense for modern CSS areas including anchor positioning, animations, fonts, masking, scroll animations, view transitions, and more. Media-query completion suggests feature names and values suited to each feature.


From our entire team, thank you for choosing Visual Studio! For the latest updates, resources, and news, check out the Visual Studio Hub and stay in touch.

Happy coding! The Visual Studio team

The post Visual Studio November Update – Faster Workflows, Better Reviews appeared first on Visual Studio Blog.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Yet another post about how AI is changing software development

1 Share

Look, AI is changing our software development profession pretty quickly and I for one don’t feel like making any kind of statement about how I knew how this is going to play out for us. All I’m going to offer is some thoughts here about my recent experiences in our new AI-centric world.

My oldest son was mentioning it to me tonight that he was interested in watching the old Spaghetti westerns, so here we go with the stereotypical breakdown:

The Good

I think the general theme here is that using AI agents has allowed us to build much more deep quality into the Critter Stack tools. If you follow me you’ve probably seen me say with some irritation that I don’t think you can just vibe code equivalents to any of the Critter Stack tools. That’s not (just) snobbishness so much as it’s knowing how much attention span it takes and how much iteration and adaptation in the face of user feedback it’s really taken to get our tools where they are right now.

More on this in its own post, but I’ve had some good results having an AI agent build out a preview of Bobcat specifications for new features in the ongoing Wolverine 7.0 work. That’s enabled me to review the high level requirements and test cases before committing to the new feature. For a quick summary, part of what Bobcat does is make automated tests render as human readable specifications for documentation after the fact and requirements review before implementation. I’m pretty happy with my own Bobcat usage so far, and hopeful for its future as the next break out “Critter.”

I think we’ve also benefitted from the Bobcat Supervisor tool we (admittedly vibe coded, but then evolved!) built to help identify flaky tests in our CI builds. To my great embarrassment, we’ve made several real message loss improvements to Wolverine by paying more attention to flaky tests and having an AI agent investigate and end up addressing the structural problems behind those test flakes.

The Critter Stack has absolutely benefitted from us frequently turning AI agents loose to do exploratory testing and chaos monkey testing against different subsystems in Wolverine or Marten/Polecat. However, that’s not magic. You have to start from a prompt that calls out the specific areas to focus on, the kind of problems to try to simulate, and examples of other problems. I’ve frequently sent an AI agent at exploratory testing against the exact same subsystem, but with different inputs and flushed out completely different problems.

All in all, I’m finding it much cheaper to write test harnesses for performance testing or sad path cases or hardening code for highly concurrent usage. But again, you have to give the AI agents some specific guidance first. It’s not magic, you have to still think of what to do.

AI agents have been great for reviewing documentation for outdated material or missing features that aren’t accounted for in the documentation. It’s also been very helpful for me to make much more cross reference links between blog posts or between different tool’s documentation websites. That’s been helpful today as I’m preparing new releases to some relatively long lived codebases that have evolved quite a bit over time. But yet again, you have to think to do that and there’s no magic happening.

AI agent usage is leading to the discovery of a lot of latent bugs across the Critter Stack, and I’d guess that we’ve probably addressed over 200 issues so far that came from an AI agent pointing out a previously unknown problem.

The Bad

Holy shirtballs, the AI agents find a lot of problems, and that’s sometimes severely restricting my ability to move forward when I automatically try to address those as fast as they come in instead of working toward higher priority items. It’s probably time to spend more time start triaging what things really do matter and what can be delayed or even ignored instead of letting an AI agent endlessly go down rabbit holes of fixing problems for unusual permutations that no user has ever reported.

AI written prose is an abomination and you can smell it a mile away. I’ll admit that I’ve used way too much AI to draft blog posts and articles. I definitely think it’s been useful to quickly generated content, especially when you need to pull together code samples and references. I try to get away with heavily editing the AI generated prose to try to remove the cringe factor, but I’m not yet sure that’s working out perfectly.

We’re going to have to revisit our usage of GitHub soon. I still like Pull Requests mostly as a tracking device and somewhat as a review mechanism for external contributions. Like many OSS projects, we use GitHub Actions for all of our CI. We’ve very aggressively used CI to expand our test coverage, split up CI builds, and added quite a bit of integration heavy test suites to CI quality gates. And that part is great! Except that we’re getting killed by the long jobs get queued up in GitHub Actions because of all the yahoos like me who are hammering GitHub Actions through far more frequently pushes. At this point, GitHub Actions is probably the most significant bottleneck in Critter Stack development. I’ve been experimenting with other workarounds, like batching up pull requests or trying to build out optimized “Local Gates” to side step the problem. Like many other people, I’m weighing the risks of using more targeted quality or testing gates for certain changes as another way of reducing the CI delays. I’m going to have to call this one a work in progress. I’m struggling with this very problem today while trying to finish off our next round of major version releases.

The Ugly

The context switching is exhausting. The AI Brain Fry thing is unfortunately quite a real thing in my experience so far. After any big spurt of development work monitoring multiple agents, I’m finding myself needing to take an easy day to recover. I’m lucky that my job is flexible enough to get away with that, but others probably aren’t so lucky.

I’m not sure that I enjoy software development nearly as much as I did before but we’ll see how everything plays out ¯_(ツ)_/¯

Other Concerns

I’m horrified at the stories of the power usage of the new data centers and more so when the data centers are using their own Diesel or Natural Gas generators. It would be an awfully nice time for the US to not be so actively hostile to green energy technology.

Discord traffic related to Critter Stack questions has plummeted even though our download numbers are still trending upward. It’s clear that AI will have a serious impact on any kind of software services model, but it’s too early to say what exactly that means.



Read the whole story
alvinashcraft
2 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Is “sort by impact” just vibes?

1 Share

“Give me the top five, sorted by impact.” People ask AI agents for this all the time, whether it’s a backlog or a pile of growth ideas. Yet “impact” is one of the vaguest words in the language. It could mean how many users benefit, how much money comes in or how much you get for the effort. Hardly anyone says which, so we suspected the order agents come back with is just vibes. It looks plausible, but there’s nothing behind it.

We were wrong, though not in a reassuring way. Across 1,500 runs with four models, agents ranked the same list in nearly the same order every time, and different models largely agreed with each other. Our prompt never said what impact meant, so the agents picked a definition themselves, and which one depended on the subject: users reached for a developer-tool backlog, revenue for an online shop and severity for security work. When every item came with a dollar figure, “impact” meant the biggest dollar figure, every time.

Three kinds of vibes

When you ask an agent to sort a list by impact, the order you get back can be vibes in three ways, and each one needs to be fixed in a different way.

Kind of vibes What you’d see What fixes it
Noise Ask again and you get a different order Ask several times, or don’t trust the ranking
Artifact The order copies something irrelevant, like the order of your list Shuffle the list before you ask
Hidden default The same order every time, based on a definition of impact the agent picked Tell the agent what impact means

Eight items, ranked over and over

If we let the agent come up with its own ideas, we’d be testing two things at once: which ideas it picks and how it ranks them. So we gave it a fixed list of eight items to rank. The first list was a backlog for devkit, a made-up open-source CLI with a paid Team tier:

I maintain devkit, an open-source CLI for scaffolding and deploying serverless apps.
The core is free; a paid Team tier adds collaboration features.

Here's our backlog:

- win-paths: Fix the crash on Windows when the project path contains spaces
- sso: Add SSO/SAML login to the Team tier
- quickstart: Rewrite the getting-started docs and add a 5-minute quickstart
- deploy-speed: Cut `devkit deploy` cold start from 40s to 10s
- ...

Sort these by impact, most impactful first.

Every reply had to end with a RANKING: line listing all eight items, so we could compare orders automatically. Each list came in two versions. One had titles only, the way people usually paste a list into a chat. The other added data to each item, like “hits ~15% of users; est. 1 day”. Then we asked for the ranking in several ways:

What we asked What it tells us
“Sort these by impact”, 15 times Noise: do repeated runs agree?
The same, with the list reversed Artifact: does an item’s position in the list affect its rank?
Come up with 5 ideas, then sort them by impact Artifact: is the ranking just the order the ideas came out in?
“Sort by impact, where impact means…” users reached, revenue or value per day of effort Hidden default: which definition does plain “impact” match?
“Define impact first, then sort” Does it make the ranking more consistent?

Claude Sonnet 5.5, Claude Haiku 5.5, GPT-6.1 Sol and GPT-6 Luna ranked the backlog 15 times per prompt. We ran everything in Vally, Microsoft’s evaluation tool for AI agents, with the GitHub Copilot SDK as the agent.

The first round said “impact means reach”

On the backlog, the “sort by impact” ranking came closest to sorting by users reached. When the agents explained their ranking, most said they’d ranked by reach or by a mix that included it. Impact meant reach, apparently.

One domain is one data point, so we added two more, and this time we wrote down beforehand what would count as a result. The shop domain was a list of growth initiatives for Northbean, a small online coffee roaster. The risk domain was a list of security improvements for Ledgerly, a B2B invoicing SaaS. In the version with data, every item now had three numbers: how many people it reaches, how much money it’s worth and how many days it takes.

- cart-email: Send an abandoned-cart reminder email
  (reaches ~8,000 people/month; est. +$40k/yr revenue; est. 1 day)
- microlot-club: Launch a $45/month limited-microlot club for top customers
  (reaches ~150 people/month; est. +$70k/yr revenue; est. 2 days)

We picked the numbers so that sorting by reach, by money and by effort gave three completely unrelated orders. That way, we could tell which number the agents followed. We also had Claude Haiku 5.5 read every answer and note what the agent said it had ranked by. Claude Sonnet 5.5 and GPT-6.1 Sol ran both new domains, 15 times per prompt.

Ask again and you get the same order

Pick any two items from a list, and two runs of the same prompt put them in the same order 86% to 100% of the time, depending on the model and the list. That’s about as consistent as when we spelled out what impact meant. Different models agreed on 77% to 93% of pairs, and on 87% to 100% once the list had data.

An item’s position in the input had almost nothing to do with its rank, and reversing the list changed the full ranking only slightly. With titles only, 64% to 100% of runs picked the same #1 item. The backlog was the only list where reversing it changed the top pick. Claude Sonnet 5.5, for example, put the quickstart first in the original order and the Windows crash fix first in reverse. When agents came up with five ideas and then sorted them, the sorted order had little to do with the order they’d thought of them in, and no run handed the list back unchanged.

The hidden default depends on the domain

So what were the agents ranking by? With titles only, it depended on what the list was about. Reach, our answer from the first round, only held for the developer-tool backlog.

Domain Ranking closest to What the agents said they ranked by
Developer-tool backlog Users reached Reach, or a mix that included it
Online shop Revenue Money (GPT-6.1 Sol), or a mix (Claude Sonnet 5.5)
Security Losses avoided Severity

On the security list, the agents ranked by how bad each risk was, and enforcing hardware-key MFA for all employees came first in every run for both models. Of our three definitions, losses avoided came closest, but the agents talked about severity, which none of our definitions covered.

With dollar figures, impact meant the biggest dollar figure

When every item stated reach, money and effort, Claude Sonnet 5.5 and GPT-6.1 Sol sorted by the money column on both the shop and the security list. In every run, the ranking matched the money order exactly and had nothing to do with the reach order. The abandoned-cart email reached more than 50 times as many people as the microlot club and took half the time, and the agents ranked the microlot club higher anyway, because it was worth $70k instead of $40k.

Asking the agent to define impact didn’t help

On paper, the obvious fix is to make the agent say what it means by impact before it ranks anything. In practice, it didn’t make the rankings any more consistent, and for three of the four models, it made them less so.

What we’d test next

The first thing we’d test is whether people do any better. Give the same lists to product managers and engineers, ask them to sort by impact, and compare how often they agree with each other and with themselves a week later. If people pick different definitions too, the problem is the request itself, and you’d need to define impact no matter who does the ranking.

We’d also widen the lists. We tested three domains with one list of eight items each, all of them business decisions. A list of twenty items, or one outside business entirely, like which research papers to read first, would show whether agents still settle on one definition per domain.

What to do when you ask for a ranking

If you ask an agent to sort anything by impact, or by a word that’s just as vague, like priority or importance, say what you mean by it, such as expected revenue or value per day of effort. If you don’t, the agent picks one for you, and it might not be the one you had in mind. Asking the agent to define impact first sounds rigorous, but you still get a definition the agent chose, and in our runs the rankings got less consistent. If you’re not sure which definition fits, ask for several rankings, one per definition, and compare them. Items that rank high on every definition are the safe bets, and the ones that move are where the real decision is.

Watch what data you put in the list, because the numbers you add define “impact” as much as the words do. If your items carry dollar figures, expect the agent to sort by them and ignore everything else you included.

If you build skills, prompts or agents that rank things for people, like triaging incoming issues or summarizing review findings, put the definition in the instructions. When a word is ambiguous, an agent quietly picks a definition and sticks to it. Like the preferences people attribute to models, that definition comes from the context, such as the subject of the list or the numbers in it.

If you evaluate agents that rank, add the word itself to your list of hidden variables. The same prompt tests one definition on a shop’s growth ideas and a different one on a security backlog.

So, is “sort by impact” just vibes?

“Sort by impact” turned out far more consistent than we expected. Agents gave nearly the same ranking run after run and mostly agreed with each other, whatever order the list came in.

It’s vibes in a subtler way. The agent ranks by a definition it picks from the subject of the list: reach for a developer tool, revenue for a shop, severity for security and the biggest dollar figure whenever there is one. Because the ranking comes back the same every time and sounds well-reasoned, it’s easy to mistake for a judgment you agreed with.

The post Is “sort by impact” just vibes? appeared first on Microsoft for Developers.

Read the whole story
alvinashcraft
2 minutes ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories