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
You put these reusable cross-cutting capabilities in middleware or shared pipeline hooks around agent and tool calls. That gives every agent consistent logging, authorization, and exception handling. Pasting prose into prompts, disabling controls, or relying on CSS-layer auth won't enforce them.
Full Explanation
Designing middleware for reusable capabilities — logging, authorization, exception handling — is an explicit develop-domain skill. The middleware approach centralizes those concerns in the invocation pipeline. Copy-pasting slightly different logging code into every agent prompt in natural language only is unenforceable and inconsistent. Disabling logging and authorization to reduce latency increases operational and security risk. Performing authorization only in the presentation CSS layer of a web chat widget 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.