You need reusable cross-cutting capabilities across many agents: correlation logging, authorization checks before tool calls, and normalized exception handling. Which design best implements this?
Select an answer to reveal the explanation.
Short Explanation
You need middleware or shared pipeline hooks that wrap agent and tool calls so logging, authorization, and exception handling are reused consistently. Central hooks beat copy-pasted prompt fragments and one-off prints, and they let you emit correlation identifiers.
Full Explanation
The middleware or shared pipeline hooks design is correct because multi-agent development includes middleware for reusable capabilities such as logging, authorization, and exception handling. Shared pipelines ensure consistent security and observability. Duplicating custom logging and auth snippets independently in every agent prompt with no shared code is incorrect because prompt-only duplication is inconsistent and unenforceable. Disabling authorization to simplify middleware is incorrect because removing authorization increases risk. Logging only to console.print in one developer's terminal session is incorrect because local console logging lacks retention, access control, and cross-service correlation. Operational check: place authorization checks before tool execution and map exceptions to orchestrator-safe error types.