The agent from the last lessons is open: It decides for itself which tool to call and when. That's right for a conversation in which nobody knows beforehand what will be asked. For the actual path of a quote, though, it's too open. This path is fixed: assess the tender, draft a quote only if it's a fit, have it approved, send it. Nobody wants a model to decide to skip the assessment today.

For fixed processes there are workflows. In this lesson, you build the Kladde's quote workflow. It uses the model in exactly two places, for the assessment from T2.3 and for the proposal of the lines. Everything else is functions.

New is the package for workflows:

Bash
dotnet package add Microsoft.Agents.AI.Workflows --version 1.28.0 --project src/Kladde.Agents/Kladde.Agents.csproj

Executors and edges

A workflow is a graph. Its nodes are called executors: small units that receive a message of a certain type and pass a message on. The edges say where a message goes. An edge can have a condition; then the message goes along it only where the condition holds. An executor can be anything: a method, a call to a model, a whole agent, or a question to a person.

The quote workflow looks like this:

QuoteRequest
   │
   ▼
AssessTender (fixed, one model call as in T2.3)
   ├── suitable or partly suitable ──► ProposeQuote (model) ──┬── proposal valid ──► PriceQuote (fixed)
   │                                                          │                          │
   └── unsuitable or not assessed ──► Skip (fixed)            └── invalid ──► Manual     ▼
                                                                                  QuoteApproval (person)
                                                                                         │
                                                                                         ▼
                                                                                  SendApproved (fixed) ──► result

What each step does, and why it's built that way:

Step Kind Why
AssessTender one model call in fixed code The assessment from T2.3: structured answer, checked in code, with one follow-up request. No agent needed.
ProposeQuote model Which roles and how many days a tender needs is something code can't know. The result is still checked in code.
PriceQuote function The Kladde calculates prices from its day rates.
QuoteApproval person The approval from lesson 3, now as a step of the workflow.
SendApproved function Records the approval and sends through SendQuote, exactly once.
Skip, Manual function An exit with a reason. What doesn't go on ends with a person, never in nothing.