Do Zero ao Grafo Multiagente em .NET com Microsoft Agent Framework e DuckDB
Muito se fala em Python quando o tema é Inteligência Artificial Generativa. No entanto, quando entramos no território de sistemas corporativos, tipagem estrita, alta performance, governança e microsserviços , o ecossistema .NET (C#) oferece uma base arquitetural sólida e madura. Neste artigo, vamos analisar a engenharia por trás do DecisionFlow.cs , o núcleo inteligente do projeto Olist.Agents .…
The article discusses the engineering behind DecisionFlow.cs, the intelligent core of the Olist.Agents project, which models the maturity of production and real architectural patterns with AI agents. It outlines how to abstract language models using Microsoft.Extensions.AI, the purpose of AIAgents and their tools, the use of Executors in a graph-based workflow, and how to implement RAG on real data with Cadu.
The first step involves decoupling from proprietary SDKs using the unifying IChatClient interface in .NET. It encapsulates the Google Gemini client, allowing flexibility in choosing inference engines like Gemini, Azure OpenAI, Claude, or local models via Ollama. The abstraction provides resiliency against transient network errors, 503 and 429 status codes, and exponential backoff retries.
Next, the article introduces the Model Context Protocol (MCP), which standardizes how AI models discover and trigger external tools via JSON-RPC/HTTP. This protocol translates tools into AITool instances for consumption by agents without intermediate SDKs. The Cadu agent implements Structured RAG (RAG) using a real dataset with over 100,000 records, auditing anomalies in product ads.
The Cadu agent retrieves product IDs and decides to trigger its tool, _sqlConsultTool.GetCaduTools(), which executes SQL-like queries on structured data (products, order_items, sellers) using DuckDB + Dapper, without the complexity of a dedicated relational database. The retrieved facts are incorporated into the agent's context, allowing it to make informed decisions and perform its validation tasks.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.