.NET Before vs After the AI Era
Artificial intelligence is not here to replace .NET developers. It is here to extend what they can build. The fundamentals you already know — services, APIs, data access, validation — still matter. What changes is how you compose them. What Is Agentic AI? defines the bounded runtime behind the agent examples.
Instead of shipping systems that only move data, you design systems that understand context, reason over it, and take action. Twelve practical shifts turn a traditional .NET codebase into a production-ready AI system. Framework and product examples are current as of July 2026; APIs and defaults may change. For tool and remote-agent boundaries, use MCP vs A2A vs ACP.
From Repository Calls to AI Agents
A repository gives you a record. That is useful, but modern applications often need more than raw fields — they need interpretation. An AI agent wraps your data access with reasoning. Rather than returning a customer entity and pushing interpretation to the UI, the agent can summarize behavior, flag churn risk, and highlight next steps in one call.
Quick reference
- Keep repositories for CRUD; wrap them inside agents for interpretation and summarization.
- Return structured agent output (summary, risk score, suggested actions) — not raw LLM text.
- Log which data the agent accessed for audit and debugging.
Remember this
Stop thinking only in terms of data retrieval. Start thinking in terms of intelligence retrieval.
From SQL LIKE to Vector Search
Keyword search breaks the moment users phrase questions differently from your database content. Vector search matches meaning, not just characters. Embeddings let users ask natural questions like “How can I reduce claim rejection?” and still get relevant policy or document results.
Quick reference
- Chunk documents with overlap so answers are not cut mid-sentence.
- Store embeddings in a dedicated vector store — do not query vectors in SQL Server unless you must.
- Re-rank top-k results before sending them to the LLM for better precision.
Remember this
Semantic search turns static document stores into knowledge bases users can actually talk to.
From REST APIs to MCP Tools
REST endpoints are powerful, but they are built for developers who already know your API surface. MCP (Model Context Protocol) exposes capabilities as tools that agents can discover and invoke. Your backend stays the source of truth, but the interaction model becomes agent-friendly instead of human-integration-friendly.
Quick reference
- Expose each capability as a named tool with a JSON schema for parameters.
- Keep REST APIs for human integrations; add MCP for agent-driven workflows.
- Validate tool inputs server-side — agents can hallucinate argument shapes.
Remember this
Design backend capabilities as tools, not just HTTP endpoints.
From Business Rules to Prompt-Driven Agents
Deterministic rules remain the authority for compliance limits, permissions, and approvals. A model can summarize evidence or recommend a route when policy language is nuanced, but its output should not become an approval decision until authorization checks, measured eval thresholds, and a recoverable human-review path are in place.
Quick reference
- Authorize the caller and allowed action before exposing order data or accepting a recommendation.
- Require structured output (recommendation, reasons, uncertainty); deterministic policy or a human owns the final approval.
- Version prompts and ship only above a documented golden-set threshold, with abstention and manual recovery below it.
Remember this
Use models to support judgment only when policy enforcement and final approval remain controlled and recoverable.
From CRUD Reads to RAG Questions
Fetching a policy by ID assumes the user already knows what to look for and how to read it. Retrieval-Augmented Generation (RAG) lets users ask direct questions against your documents and get grounded answers. The system retrieves relevant chunks first, then generates a response based on real source material.
Quick reference
- Retrieve first, generate second — never let the LLM answer without source chunks.
- Cite document IDs or page numbers in responses for trust and verification.
- Refresh embeddings when source documents change.
Remember this
Turn document storage into question answering with RAG.
From Service Layers to Autonomous Agents
Service classes are the right place for known workflows, authorization, invariants, and transactions. An agent may propose or select among bounded next steps when context changes the route, but deterministic code must validate every tool call and contain failures; the agent does not replace the workflow's safety boundary.
Quick reference
- Authorize each allowed tool and resource; never inherit the model's claimed identity or scope.
- Keep domain validation and transaction boundaries in code; require eval thresholds before enabling autonomous routing.
- Make retries idempotent, cap steps/cost, isolate side effects, and persist enough state for human recovery.
Remember this
Agents may choose among bounded workflow steps; code retains authorization, validation, transactions, and recovery.
From Cache Keys to Semantic Memory
Caching is fast when you already know the key. Semantic memory is useful when you need relevant prior context without naming it exactly. Instead of storing one blob under one key, you store knowledge in a way that can be recalled by meaning — previous rejections, customer preferences, or recurring failure patterns.
Quick reference
- Store memories as embeddings with metadata (user, session, timestamp).
- Retrieve top-k relevant memories per query — do not inject full history.
- Expire or summarize old memories to control cost and relevance.
Remember this
Memory for AI systems should be contextual, not just key-based.
From Application Logs to AI Observability
Standard logging tells you that something happened. AI observability tells you how an agent reasoned through a task — which tools it called, what prompt it used, how long inference took, and where quality broke down. Tools like LangSmith and OpenTelemetry help you trace agent behavior the same way you trace distributed requests.
Quick reference
- Trace prompt, model, tokens, latency, and each tool call in one span tree.
- Alert on cost and quality regressions, not only HTTP 500s.
- Sample traces in production — full capture is expensive at scale.
Remember this
If you cannot observe agent behavior, you cannot trust it in production.
From Background Jobs to AI Workflows
A background service is ideal for repetitive scheduled work. AI workflows are better when each run may involve different steps — load data, analyze, summarize, notify, escalate. State graphs let you define these stages explicitly while still allowing agents to handle the intelligent parts.
Quick reference
- Model each stage explicitly so failures can resume from the last good step.
- Use queues for long-running AI steps — do not block HTTP requests.
- Persist workflow state so retries do not duplicate side effects.
Remember this
Model AI pipelines as workflows, not just timers and loops.
From Controllers to AI Copilots
Controllers expose rigid contracts: DTO in, DTO out. Copilots let users describe intent in natural language. That does not replace APIs for system-to-system communication, but it dramatically improves human-facing experiences for operations teams, support staff, and internal tools.
Quick reference
- Copilots translate intent to existing service calls — do not bypass validation.
- Confirm destructive actions with the user before executing tools.
- Show what the copilot understood before running create/update operations.
Remember this
Natural language interfaces are a new layer on top of your existing domain services.
From DTO Validation to AI Validation
Field validators enforce shape, invariants, and policy checks that must be deterministic. A model can flag ambiguous intent, missing context, or contradictions across a document, but that output is advisory until measured against a representative eval set and routed to a deterministic rule or human reviewer.
Quick reference
- Keep FluentValidation and authorization for enforceable rules; use AI to surface candidates for review.
- Return structured findings (field, evidence, severity) and validate the schema before downstream use.
- Set an eval-backed acceptance threshold; abstain or route to a human on uncertainty, model failure, or conflicting evidence.
Remember this
Use AI as an advisory reviewer for contextual ambiguity, never as the sole enforcement boundary.
From Microservices to AI Systems
Classic microservice architecture flows through layers: controller, service, repository, database. AI system architecture flows through intelligence: agent, MCP server, vector database, LLM, and tools/APIs. The shift is not “delete your services.” It is “place an intelligent coordination layer above them.”
Quick reference
- Microservices remain the data and transaction layer; agents sit above them.
- Add vector stores and tool gateways as first-class infrastructure components.
- Design for observability and cost control from the first AI feature.
Remember this
Architect for understanding and action, not only for data processing.
Key takeaway
The useful shift is not replacing repositories, policies, or validators with a model. It is placing one bounded AI adapter above deterministic code, then proving that the old contract still holds when the model succeeds, abstains, times out, or proposes an unauthorized action.
Practice (30 min, before → after): run dotnet new xunit -n AiBoundaryLab. First write a deterministic ApprovalPolicy.RequiresReview(amount) test where 100001m returns true. Then wrap that policy with a fake IAiReviewer that returns a recommendation plus evidence, while the policy remains final. Add three tests: a normal recommendation preserves the policy result; a timeout returns NeedsHumanReview; and a recommendation to auto-approve 100001m is denied. Run dotnet test. Pass only when all three tests are green, the timeout is bounded, and replacing the reviewer with a throwing fake cannot bypass the original rule.
Related Articles
Explore this topic