In a multi-agent pipeline, Agent A produces a structured JSON artifact and hands it off to Agent B. Agent B expects a specific schema but receives a malformed artifact. What design practice prevents this handoff failure?
Select an answer to reveal the explanation.
Short Explanation and Infographic
APIs have contracts, not suggestions. The handoff between agents deserves the same discipline as a REST API: define the schema, validate the payload, and reject malformed inputs at the boundary rather than letting garbage data corrupt downstream work.
Full explanation below image
Full Explanation
Agent handoff artifacts require schema contracts — explicit definitions of the expected structure, types, and required fields that both producer and consumer agents must honor.
Implementation: 1. Define a JSON schema (using JSON Schema standard) for each handoff artifact. 2. Agent A validates its output against the schema before emitting. 3. The orchestrator (or a validation step) validates the artifact after Agent A produces it and before Agent B receives it. 4. Validation failures trigger an error path (retry, escalation, or human review) rather than passing malformed data downstream.
Why B is correct: Schema validation at the handoff boundary is the correct design. It catches malformed outputs early, before they propagate through the pipeline and cause more complex failures.
Why A is wrong: Natural language descriptions are ambiguous and not machine-parseable in a reliable, structured way. Agent B cannot reliably extract structured data from a natural language description of JSON.
Why C is wrong: Retrying the handoff without changing what Agent A produces will keep receiving the same malformed output. Retries are appropriate for transient failures (network issues), not for structural output problems.
Why D is wrong: Asking Agent B to 'reason around' malformed inputs relies on the model to correctly infer missing or incorrect fields — an unreliable strategy that produces unpredictable behavior and silently propagates errors.