AI

From Local RAG to an AI Agent in C# with Ollama and Qdrant – Part 3

The third part of the series moves a local C# agent from free-form tool calling to deterministic Agent Workflows in Microsoft Agent Framework. A workflow collects deployment status, errors and Qdrant documentation in a fixed order, then hands the evidence to a tool-less agent for analysis, with a human approval gate before sensitive actions.

Ottorino Bruni Ottorino Bruni
Published
Reading time
22 min read
agent run #20
agent run #20
Go to original ottorinobruni.com

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Key points

  • Replace model-driven tool selection with a fixed C# sequence when the order of steps must be guaranteed.
  • WorkflowBuilder, Executor, AddEdge and WithOutputFrom define the flow; Build() produces the runnable workflow.
  • CollectDiagnosticsExecutor chains deployment status, recent errors and a Qdrant documentation search, so all three always run.
  • The analysis step uses an AIAgent without tools and a prompt that separates observed facts from hypotheses.
  • RequestPort enables a human-in-the-loop approval gate before sensitive actions such as a deployment restart.
  • Run it locally with InProcessExecution.RunAsync, inspect ExecutorCompletedEvent, and trigger it from the console with /diagnose.

In the final part of this series, Ottorino Bruni adds two Microsoft Agent Framework features to a local C# agent built on Ollama and Qdrant. The first is Agent Workflows: instead of trusting llama3.2 to pick the right tools in the right order, the application defines the sequence in code with WorkflowBuilder, Executor classes and edges connecting them.

A CollectDiagnosticsExecutor calls the deployment, log and document services in order, and an AnalyzeDiagnosticsExecutor sends the gathered evidence to a tool-less agent that writes the report. A RequestPort step is meant to require human approval before anything sensitive such as a restart runs, reinforcing that AI recommends while the application stays in control. The code uses Microsoft.Agents.AI.Workflows 1.23.0 on .NET 10, run in-process and triggered from the console with /diagnose.

Real-world use

  • An incident-triage tool where logs, deployment state and docs must always be checked before a human sees a diagnosis.
  • An internal ops assistant that drafts a restart recommendation but waits for an operator's approval before executing anything.
  • A support bot on a Qdrant knowledge base whose evidence gathering must be repeatable instead of left to the model's tool choice.

Why it matters

If your agent can act, not just answer, letting the model choose the steps is a reliability and safety risk; workflow edges plus an approval port put the application back in control.

This summary was generated by the agent from the original post on Ottorino Bruni. The full text and all rights belong to its author and publisher. Go to original

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message