Every AI agent framework you've heard of is in Python. LangChain, CrewAI, AutoGen, LangGraph — all Python.
So when I started building AgentCraftLab, people asked the obvious question: why .NET?
Here's the honest answer.
The Enterprise Reality
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.
When we wanted to add AI agent capabilities, the options were:
- Use a Python framework — introduce a new language, new runtime, new deployment pipeline, new hiring requirements
- Use Semantic Kernel — Microsoft's answer, but it felt like wrapping OpenAI calls in enterprise abstractions
- Build something native — .NET 10, Microsoft.Extensions.AI, same stack the team already knows
We picked option 3.
The Problem with No-Code Agent Builders
There's another category: visual no-code platforms like Flowise, Dify, n8n. They're great for demos. Drag some nodes, connect them, done.
Until you hit the wall.
Someone on Reddit put it perfectly:
"Drag-and-drop gets you 70% there, then you're stuck debugging YAML or rebuilding in code."
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.
The Escape Hatch: Write C# Right in the Canvas
That feedback shaped our core design decision. In AgentCraftLab, every workflow has Code nodes where you can drop into real code at any point:
// This runs inside the workflow canvas — not in a separate project
var orders = JsonSerializer.Deserialize<List<Order>>(input)!;
var vipOrders = orders
.Where(o => o.Total > 1000)
.OrderByDescending(o => o.Total)
.ToList();
return JsonSerializer.Serialize(vipOrders);
This isn't a template or a formula bar. It's real C# with full LINQ, System.Text.Json, System.Text.RegularExpressions — compiled at runtime via Roslyn and executed in a sandboxed environment.
The editing experience uses Monaco Editor (the VS Code engine), so you get syntax highlighting, bracket matching, and auto-formatting right in the browser.
How the Sandbox Works
Running user code at runtime is dangerous. Here's how we handle it:
1. AST Security Scanning — Before compilation, we parse the code into a Roslyn SyntaxTree and scan every node. Any reference to File, Process, HttpClient, Assembly, Environment, or other dangerous APIs is blocked before the code even compiles.
2. Reference Whitelisting — The compiler only gets safe assemblies. System.Linq and System.Text.Json are in. System.IO.FileSystem and System.Net.Http are not. Even if the AST scanner misses something, the compiler can't find the types.
3. Collectible AssemblyLoadContext — 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 CSharpScript.EvaluateAsync().
4. Timeout Enforcement — Scripts run inside Task.Run with a hard timeout. Infinite loops get killed.
AI Generates the Code For You
Not everyone wants to write C# by hand. So we added an AI code generator:
- Type what you want in natural language: "Filter orders over $1000, sort by total descending, output as CSV"
- The LLM generates both the C# code and sample test data
- Click "Run" to test it instantly in the sandbox
- Click "Apply" to save it to the node
The system prompt switches automatically between JavaScript and C# rules based on the selected language.
What We Actually Built
AgentCraftLab is a visual AI agent workflow platform:
- 10+ node types: Agent, Condition, Loop, Router, Code, Parallel, Iteration, Human-in-the-loop, HTTP Request, A2A Agent
- 5 execution strategies: Single, Sequential, Concurrent, Handoff, Imperative
- Dual script languages: JavaScript (Jint) + C# (Roslyn) in Code nodes
- RAG pipeline: Extract, chunk, embed, hybrid search (FTS5 + vector + RRF)
- Enterprise middleware: GuardRails content filtering, PII masking (35 rules x 6 locales), rate limiting
- Multi-protocol deployment: A2A, MCP, REST API, Teams Bot
-
1250+ unit tests, zero warnings,
TreatWarningsAsErrorson all projects
The frontend is React (React Flow + CopilotKit + shadcn/ui). The backend is pure .NET 10 with Microsoft.Extensions.AI — no Semantic Kernel dependency.
The .NET AI Ecosystem is Ready
A year ago, building this would have been painful. Today:
-
Microsoft.Extensions.AI provides a clean
IChatClientabstraction across OpenAI, Azure, Anthropic, Ollama - Roslyn gives us runtime C# compilation with full control over references and assembly loading
-
.NET 10 with
LangVersion 13has all the modern language features - CSharpCompilation + collectible ALC solves the memory leak problem that plagued earlier scripting approaches
The gap between Python and .NET for AI is closing fast. The frameworks just need to catch up.
Try It
AgentCraftLab is open source (Apache 2.0):
GitHub: github.com/TimothySu2015/agent-craft-lab
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.
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.
``
Top comments (0)