Woodgrove Bank runs a loan-advice agent built with Microsoft Agent Framework. The team registers four agent middleware components:
- Logging: records each request as it receives it, and the final response.
- Redaction: removes account numbers from the prompt before passing it on.
- Authorization: returns a rejection response directly, without calling the next layer, when the caller lacks the required role.
- Moderation: sends the prompt to an external content-moderation API and blocks prompts that fail.
Requirements:
- The log must record each prompt exactly as the caller sent it.
- Account numbers must never be sent to the external content-moderation API.
- Requests rejected by Authorization must still be logged.
- Requests rejected by Authorization must not be sent to the external content-moderation API.
Which two registration orders, listed from first registered to last registered, meet all the requirements? Each correct answer presents a complete solution.
Middleware nests in registration order: the first registered component is the outermost layer and sees the input before any other layer modifies it. Logging must therefore be first so it records raw prompts and also sees requests that Authorization later rejects. Redaction and Authorization must both sit outside Moderation, because Moderation must receive only redacted prompts and a short-circuiting Authorization layer stops inner layers from running. Redaction and Authorization can appear in either order, which gives the two valid sequences.
- Adding MiddlewareMicrosoft Learn