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
Treat agent handoffs like API contracts: define the schema, validate the payload, and reject bad data at the boundary. You don't let garbage flow downstream and corrupt the rest of the pipeline.
Full Explanation
Agent handoff artifacts require schema contracts — explicit definitions of the expected structure, types, and required fields that both the producing agent and the consuming agent must honor.
Implementation: 1. Define a strict JSON schema, using the JSON Schema standard, for each handoff artifact. 2. The producing agent validates its output against the schema before emitting it. 3. The orchestrator, or a validation step, validates the artifact after the producing agent produces it and before the consuming agent receives it. 4. Validation failures trigger an error path, such as retry, escalation, or human review, rather than passing malformed data downstream.
Schema validation at the handoff boundary is the correct design because it catches malformed outputs early, before they propagate through the pipeline and cause more complex failures.
The option that has the producing agent describe its output in natural language is wrong because natural language descriptions are ambiguous and not machine-parseable in a reliable, structured way. The consuming agent cannot reliably extract structured data from a natural language description of JSON.
The option that has the consuming agent retry the handoff multiple times is wrong because retrying the handoff without changing what the producing agent emits will keep receiving the same malformed output. Retries are appropriate for transient failures, such as network issues, not for structural output problems.
The option that lets the consuming agent work around malformed inputs using its reasoning capabilities is wrong because asking the consuming agent 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.