<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Timothy Su</title>
    <description>The latest articles on DEV Community by Timothy Su (@timothy_su_1df9506e0f041a).</description>
    <link>https://dev.to/timothy_su_1df9506e0f041a</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3865553%2F01f5b140-9c8e-4c52-a0c9-bc5fc43519b6.jpg</url>
      <title>DEV Community: Timothy Su</title>
      <link>https://dev.to/timothy_su_1df9506e0f041a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/timothy_su_1df9506e0f041a"/>
    <language>en</language>
    <item>
      <title>Why I Built an AI Agent Framework in .NET Instead of Python</title>
      <dc:creator>Timothy Su</dc:creator>
      <pubDate>Tue, 07 Apr 2026 10:28:36 +0000</pubDate>
      <link>https://dev.to/timothy_su_1df9506e0f041a/why-i-built-an-ai-agent-framework-in-net-instead-of-python-bj9</link>
      <guid>https://dev.to/timothy_su_1df9506e0f041a/why-i-built-an-ai-agent-framework-in-net-instead-of-python-bj9</guid>
      <description>&lt;p&gt;Every AI agent framework you've heard of is in Python. LangChain, CrewAI, AutoGen, LangGraph — all Python.&lt;/p&gt;

&lt;p&gt;So when I started building &lt;a href="https://github.com/TimothySu2015/agent-craft-lab" rel="noopener noreferrer"&gt;AgentCraftLab&lt;/a&gt;, people asked the obvious question: &lt;strong&gt;why .NET?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's the honest answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Enterprise Reality
&lt;/h2&gt;

&lt;p&gt;I work in enterprise environments where .NET is the backbone. The backend is C#. The CI/CD is Azure DevOps. The team knows C#, not Python.&lt;/p&gt;

&lt;p&gt;When we wanted to add AI agent capabilities, the options were:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Use a Python framework&lt;/strong&gt; — introduce a new language, new runtime, new deployment pipeline, new hiring requirements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Semantic Kernel&lt;/strong&gt; — Microsoft's answer, but it felt like wrapping OpenAI calls in enterprise abstractions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build something native&lt;/strong&gt; — .NET 10, Microsoft.Extensions.AI, same stack the team already knows&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We picked option 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem with No-Code Agent Builders
&lt;/h2&gt;

&lt;p&gt;There's another category: visual no-code platforms like Flowise, Dify, n8n. They're great for demos. Drag some nodes, connect them, done.&lt;/p&gt;

&lt;p&gt;Until you hit the wall.&lt;/p&gt;

&lt;p&gt;Someone on Reddit put it perfectly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Drag-and-drop gets you 70% there, then you're stuck debugging YAML or rebuilding in code."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The moment you need custom business logic — a specific data transformation, a validation rule, an edge case handler — you're stuck. The visual tool can't express it, and there's no escape hatch.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Escape Hatch: Write C# Right in the Canvas
&lt;/h2&gt;

&lt;p&gt;That feedback shaped our core design decision. In AgentCraftLab, every workflow has &lt;strong&gt;Code nodes&lt;/strong&gt; where you can drop into real code at any point:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// This runs inside the workflow canvas — not in a separate project&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JsonSerializer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Deserialize&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)!;&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;vipOrders&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Total&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;OrderByDescending&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;JsonSerializer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Serialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vipOrders&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't a template or a formula bar. It's real C# with full LINQ, &lt;code&gt;System.Text.Json&lt;/code&gt;, &lt;code&gt;System.Text.RegularExpressions&lt;/code&gt; — compiled at runtime via &lt;strong&gt;Roslyn&lt;/strong&gt; and executed in a sandboxed environment.&lt;/p&gt;

&lt;p&gt;The editing experience uses &lt;strong&gt;Monaco Editor&lt;/strong&gt; (the VS Code engine), so you get syntax highlighting, bracket matching, and auto-formatting right in the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the Sandbox Works
&lt;/h2&gt;

&lt;p&gt;Running user code at runtime is dangerous. Here's how we handle it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. AST Security Scanning&lt;/strong&gt; — Before compilation, we parse the code into a Roslyn SyntaxTree and scan every node. Any reference to &lt;code&gt;File&lt;/code&gt;, &lt;code&gt;Process&lt;/code&gt;, &lt;code&gt;HttpClient&lt;/code&gt;, &lt;code&gt;Assembly&lt;/code&gt;, &lt;code&gt;Environment&lt;/code&gt;, or other dangerous APIs is blocked before the code even compiles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Reference Whitelisting&lt;/strong&gt; — The compiler only gets safe assemblies. &lt;code&gt;System.Linq&lt;/code&gt; and &lt;code&gt;System.Text.Json&lt;/code&gt; are in. &lt;code&gt;System.IO.FileSystem&lt;/code&gt; and &lt;code&gt;System.Net.Http&lt;/code&gt; are not. Even if the AST scanner misses something, the compiler can't find the types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Collectible AssemblyLoadContext&lt;/strong&gt; — Each script execution compiles into a collectible ALC. After execution, the ALC is unloaded, freeing memory. This avoids the well-known memory leak problem with &lt;code&gt;CSharpScript.EvaluateAsync()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Timeout Enforcement&lt;/strong&gt; — Scripts run inside &lt;code&gt;Task.Run&lt;/code&gt; with a hard timeout. Infinite loops get killed.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Generates the Code For You
&lt;/h2&gt;

&lt;p&gt;Not everyone wants to write C# by hand. So we added an AI code generator:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type what you want in natural language: &lt;em&gt;"Filter orders over $1000, sort by total descending, output as CSV"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;The LLM generates both the C# code &lt;strong&gt;and&lt;/strong&gt; sample test data&lt;/li&gt;
&lt;li&gt;Click "Run" to test it instantly in the sandbox&lt;/li&gt;
&lt;li&gt;Click "Apply" to save it to the node&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The system prompt switches automatically between JavaScript and C# rules based on the selected language.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Actually Built
&lt;/h2&gt;

&lt;p&gt;AgentCraftLab is a visual AI agent workflow platform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;10+ node types&lt;/strong&gt;: Agent, Condition, Loop, Router, Code, Parallel, Iteration, Human-in-the-loop, HTTP Request, A2A Agent&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;5 execution strategies&lt;/strong&gt;: Single, Sequential, Concurrent, Handoff, Imperative&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dual script languages&lt;/strong&gt;: JavaScript (Jint) + C# (Roslyn) in Code nodes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG pipeline&lt;/strong&gt;: Extract, chunk, embed, hybrid search (FTS5 + vector + RRF)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enterprise middleware&lt;/strong&gt;: GuardRails content filtering, PII masking (35 rules x 6 locales), rate limiting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-protocol deployment&lt;/strong&gt;: A2A, MCP, REST API, Teams Bot&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1250+ unit tests&lt;/strong&gt;, zero warnings, &lt;code&gt;TreatWarningsAsErrors&lt;/code&gt; on all projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The frontend is React (React Flow + CopilotKit + shadcn/ui). The backend is pure .NET 10 with &lt;code&gt;Microsoft.Extensions.AI&lt;/code&gt; — no Semantic Kernel dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  The .NET AI Ecosystem is Ready
&lt;/h2&gt;

&lt;p&gt;A year ago, building this would have been painful. Today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Microsoft.Extensions.AI&lt;/strong&gt; provides a clean &lt;code&gt;IChatClient&lt;/code&gt; abstraction across OpenAI, Azure, Anthropic, Ollama&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Roslyn&lt;/strong&gt; gives us runtime C# compilation with full control over references and assembly loading&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.NET 10&lt;/strong&gt; with &lt;code&gt;LangVersion 13&lt;/code&gt; has all the modern language features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSharpCompilation + collectible ALC&lt;/strong&gt; solves the memory leak problem that plagued earlier scripting approaches&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The gap between Python and .NET for AI is closing fast. The frameworks just need to catch up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;AgentCraftLab is open source (Apache 2.0):&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/TimothySu2015/agent-craft-lab" rel="noopener noreferrer"&gt;github.com/TimothySu2015/agent-craft-lab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're a .NET developer who's been watching the AI agent space from the sidelines because everything is in Python — this is for you. Star the repo, try it out, open an issue if something breaks.&lt;/p&gt;

&lt;p&gt;And if you think this is a terrible idea and I should have just used Python — I'd love to hear why. Drop a comment.&lt;br&gt;
``&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
