cd /news/artificial-intelligence/net-ai-architect-laboratory-making-a… · home topics artificial-intelligence article
[ARTICLE · art-2649] src=dev.to pub= topic=artificial-intelligence verified=true sentiment=↑ positive

.NET AI Architect Laboratory: Making AI Work and Execute Tools (Phase 2)

Phase 2 of the .NET AI Architect Laboratory project, where an autonomous AI agent was built using .NET 10, Google Vertex AI, and Microsoft Semantic Kernel to analyze local project files for security vulnerabilities and performance issues. Key accomplishments include autonomous tool execution, dynamic switching between AI providers like Gemini and Groq, and an Angular 19 dashboard for visualizing results. Critical technical lessons learned involve resolving .NET scope traps, enforcing deterministic JSON output from small language models, and filtering token bleeding artifacts.

read2 min views7 publishedMay 20, 2026

In Phase 1 of this project, we built a type-safe “Brain” using .NET 10 and Google Vertex AI. In Phase 2, we successfully gave hands and feet to our AI substrate. By connecting Microsoft Semantic Kernel, we created an autonomous agent that can read real local project files, think independently, and detect security vulnerabilities or performance bottlenecks. Here is a quick summary of what I accomplished and the critical technical lessons I learned during Phase 2. 🛠️ Key Accomplishments Autonomous Tool Execution: The AI agent now receives a high-level goal (e.g., “Find architectural patterns and security bugs”). It automatically runs native C# plugins like ListProjectFiles and ReadCodeFile to explore and analyze the workspace without manual guidance. Dynamic Provider Routing: I implemented a dynamic runtime pipeline. The system can switch between Gemini 2.5 Flash and Groq (Llama 3.3 / Llama 3.1) on the fly based on user selection, completely decoupling the business logic from a single AI vendor. Angular 19 Cyber-Dashboard: Built a modern interface using Angular Signals and Tailwind CSS v3 to visualize the agent’s real-time analysis results, complexity scores, and strategic recommendation logs. 🧠 Important Technical Lessons Learned The .NET Scope Trap: Trying to resolve request-scoped Semantic Kernel instances directly from the root IServiceProvider container crashes the Kestrel server. I resolved this runtime boundary issue by shifting keyed service lookups to HttpContext.RequestServices to keep the kernel container safely isolated per HTTP request. Enforcing Deterministic JSON: Small models like Llama 3.1 8B love to output conversational text or messy “thought chains” instead of clean data. Prompt engineering alone is too brittle. I fixed this by forcing strict ChatResponseFormat.Json settings at the API gateway level to mechanically guarantee valid JSON parsing. The Token Bleeding Filter: Forcing an LLM to output rigid JSON payloads while explaining complex source code in Turkish can confuse the token selection matrix, leaking weird characters (like Russian or Chinese letters). Instead of wasting prompt tokens, I added a simple Whitelist Regex Sanitizer inside the client-side Angular signal flow to clean them up instantly. 🖥️ Dashboard Interface Preview Here is how the live cyber-panel looks when a Llama-driven autonomous agent evaluates local C# source code: 🚀 What’s Next? (Phase 3: Enterprise Memory) Now that our type-safe brain can execute tools and display results perfectly, the next challenge is context retention. Fitting massive codebases into a single prompt window is expensive and degrades model accuracy. Next, we start Phase 3: Enterprise Memory (RAG). I will integrate PostgreSQL/pgvector into the gateway to give our agent a permanent memory substrate of project histories and engineering standards. 🔗 Explore the Code The complete blueprint, architecture blueprints, and step-by-step implementation files for Phase 2 are fully open-source. Feel free to explore, clone, or follow along as the laboratory evolves: 👉 GitHub Repository: github.com/muratsuzen/dotnet-ai-lab

── more in #artificial-intelligence 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/net-ai-architect-lab…] indexed:0 read:2min 2026-05-20 ·