Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
DevTools and AI: Gemini AI Assistance, Chrome DevTools MCP and Recorder
The Chrome DevTools MCP server opens everything in the browser to a coding agent: without a separate profile, --no-usage-statistics and --no-performance-crux, personal sessions and URLs can leave your machine. With an agent we find and fix, via source-mapped stacks, an SPA fallback returning HTML for an API call and a NaN IndexedDB key on /books/abc; Gemini AI assistance requirements, the DevToolsGenAiSettings policy, and exporting a Recorder recording to Puppeteer.
AI Assistants in the IDE: Copilot Agent Mode, Rider AI and Safe Use
The compiler catches an invented API, but only a test that knows the business rule catches wrong behavior that compiles: MidpointRounding.HalfUp in an agent-written test gave CS0117, and an xUnit test with the boundary value 1.025 found banker's rounding in the implementation. Completion, NES, chat and agent; the AI features of Visual Studio 2026 18.x, VS Code 1.145 and Rider 2026.2; copilot-instructions.md, MCP trust and safe-use rules.
From Semantic Kernel to Microsoft Agent Framework: History, Support Status and Migrating Old Code
Semantic Kernel still gets critical bug and security fixes, but new features go to Microsoft Agent Framework; the official commitment is at least one year after MAF GA (April 3, 2026). We build the history from NuGet and GitHub dates, run an old SK agent against a local model, migrate it to MAF and derive the mapping table.
Hosting Agents in ASP.NET Core: AddAIAgent, OpenAI-Compatible Endpoints, AG-UI and A2A
You register an agent in DI with AddAIAgent and expose it over three protocols with MapOpenAIChatCompletions, MapAGUIServer and MapA2AJsonRpc; the agent is written once and the adapters only translate the format. With real calls we look at an OpenAI response with multiple choices, an AG-UI stream that carries reasoning to the browser, the A2A agent card, and claims-based session isolation with rate limiting.
Middleware, Context Providers and Session Persistence in Agent Framework
In Agent Framework, agent run middleware handles inputs like card numbers, function invocation middleware blocks access to other customers' orders, and a context provider writes the user's preference into the session, which is saved and restored as JSON. In a real run we see the memory work, the model still invent an author, and reasoning bloat the session.
Getting Started with Microsoft Agent Framework: From IChatClient to AIAgent
AsAIAgent turns an IChatClient into a ChatClientAgent; the agent takes over instructions, function invocation and chat history through AgentSession, but it doesn't make the model smarter. We write the same Bookstore assistant first with a plain IChatClient and then as an agent, and compare RunAsync, RunStreamingAsync and AgentResponse with real outputs.
Testing Code That Uses IChatClient: Fake Clients, Deterministic Tests and Microsoft.Extensions.AI.Evaluation
You test the correctness of code that uses IChatClient with a fake client, without a model and in milliseconds; you measure the model's answer quality with Microsoft.Extensions.AI.Evaluation, in separate, cached evaluation runs. In real runs we see judge timeouts, reasoning hitting an 800-token cap, a cache returning stale answers, and a Relevance score that catches a prompt bug.
Microsoft.Extensions.VectorData: Your First Collection with the Vector Store Abstraction
Microsoft.Extensions.VectorData lets you define a record with attributes and move from an in-memory store to PostgreSQL + pgvector with the same code; the generator you give the store produces the embeddings. With real outputs we look at filtered search, ScoreThreshold, how the distance function flips the meaning of the score, and a dimension bug the InMemory provider never catches.
Observing LLM Calls: UseOpenTelemetry, GenAI Semantic Conventions and the Aspire Dashboard
To observe LLM calls, put UseOpenTelemetry inside UseFunctionInvocation, listen to the same source name with AddSource and read the trace in the Aspire Dashboard. In a real trace we find that a two-minute delay came from the Ollama queue rather than the model, and see how EnableSensitiveData carries an email address into telemetry.
Controlling LLM Cost: DistributedCachingChatClient, Rate Limiting and Token Usage
We control LLM cost in three layers: DistributedCachingChatClient with Redis answers repeated questions with zero tokens, per-user rate limiting limits abuse, and a daily token budget kept with UsageDetails limits real spending. With real output we show what goes into the cache key, that entries are written without expiry by default, and why token accounting must sit inside the cache.
Taking Tool Calling to Production: FunctionInvokingChatClient Settings, DI Services and Approvals
In production, on whose behalf a tool runs comes from the session, not from the model's arguments, and irreversible actions wait for user approval through ApprovalRequiredAIFunction. With real runs we show an OrderTools class using scoped services, FunctionInvokingChatClient settings, separating tool errors from user errors, and an approval flow over two HTTP requests.
Persisting Chat History: Stateless APIs, ConversationId, EF Core and Chat Reducers
With a stateless provider your code keeps the chat history: we turn ChatMessage instances, including tool call and tool result contents, into JSON with AIJsonUtilities and store them in EF Core per user and conversation. We put the ownership check into the query, also support stateful providers through ConversationId, and compare the real output of MessageCountingChatReducer and SummarizingChatReducer.