You need reusable cross-cutting capabilities across many agents: structured logging, authorization checks before tool calls, and normalized exception handling. Where should these capabilities live in the multi-agent solution design?
Select an answer to reveal the explanation.
Short Explanation
Cross-cutting concerns belong in middleware — shared hooks around agent and tool calls for logging, authz, and exception shaping. Every agent gets the same guarantees. Option B. Pasting prose into prompts (A) is not enforceable middleware. Turning security off (C) is reckless. CSS-layer auth (D) is not a control plane.
Full Explanation
Designing middleware for reusable capabilities — logging, authorization, exception handling — is an explicit develop-domain skill. Option B centralizes those concerns in the invocation pipeline.
Option A is unenforceable and inconsistent.
Option C increases operational and security risk.
Option D places controls in the wrong tier; clients can be bypassed.
Middleware should redact secrets, enforce tool allow-lists per agent identity, and translate tool failures into orchestrator-safe errors.
Exam tip: If many agents need the same control, push it into middleware rather than each persona prompt.