Fix Multi-Agent Routing and Output Format with Few-Shot Prompts

AI-500 By islever Editorial Last updated

Design and implement advanced prompt engineering strategies in multi-agent solutions Implement multi-agent orchestration

Short answer

D Add few-shot instruction examples that demonstrate routing decisions for compound inputs and schema-compliant final outputs, so both defects are fixed without per-request code changes.

Question

You have a Microsoft Foundry project that processes customer requests through several stages: A routing agent receives investigation requests, delegates calculations to a data analysis agent that can use Code Interpreter, and delegates source-grounded summaries to a literature review agent.
You discover the following issues:
Tasks are sometimes routed to the incorrect agent.
The format of the final response is inconsistent.
You need to ensure that compound requests are routed consistently, and the final response is in a consistent format. The solution must meet the following requirements:
Minimize changes to the application code.
Apply to every future conversation handled by the agents.
Clarify the expected behavior for representative compound inputs.
Which prompt design should you implement?
  1. Add per-request prompt cues that provide JSON openers section labels, and final-answer prefixes.
  2. Add repository-wide constraints that list approved agent names, tool names, and response rules.
  3. Add system-level role instructions that define agent domains, task boundaries, and response objectives.
  4. Add few-shot instruction examples that cover routing decisions and schema-compliant final outputs. Correct Answer

Key Takeaways

The test is which prompt strategy satisfies all three constraints at once, and the trap is that the requirement to clarify behavior for representative compound inputs points to concrete few-shot examples, not abstract role boundaries.

This AI-500 scenario tests which prompt design fixes misrouting and inconsistent response format in a Microsoft Foundry multi-agent pipeline. The correct choice is D: few-shot instruction examples covering routing decisions and schema-compliant final outputs.

Common mistake: Option C is the most tempting wrong answer: system-level role instructions defining agent domains do apply to every conversation and require no code change, but they give abstract boundaries rather than representative compound-input examples, so they neither demonstrate decomposition of mixed requests nor lock in a consistent output schema.

Expert Analysis

Why few-shot examples win here. The question gives three gating requirements, and they only all line up with option D. "Apply to every future conversation" and "minimize changes to the application code" both push the fix out of runtime logic and into the prompt itself — but so do several options. The tie-breaker is the third requirement: "clarify the expected behavior for representative compound inputs." That phrasing asks for concrete input/output demonstrations, which is precisely what few-shot instruction examples are. Option D simultaneously repairs the two reported defects: routing examples (e.g., a compound request such as "calculate the churn rate for region X and summarize the supporting sources") show the router when to invoke the data analysis agent with Code Interpreter versus the literature review agent, and schema-compliant final-output examples fix the inconsistent response format.

Why option C is the attractive trap. "System-level role instructions that define agent domains, task boundaries, and response objectives" sounds ideal for a multi-agent router: it lives in the system prompt, so it applies to every conversation and needs no code change, and it does address misrouting by demarcating agent domains. The problem is that role boundaries are abstract rules, not "representative compound inputs." A generic boundary statement like "the data analysis agent handles calculations" does not demonstrate how to decompose a request that mixes a calculation with a literature summary, and it does not pin down the exact response schema, so format drift can persist. C satisfies the first two requirements but stops short of the third.

The other options fail earlier. Option A adds per-request prompt cues — that requires changing application code on every call, violating "minimize changes" and "apply to every future conversation" as a single durable fix. Option B's repository-wide constraint list of approved agent names and tool names constrains vocabulary but neither demonstrates compound-input behavior nor enforces an output format, leaving both symptoms largely unaddressed.

Verdict: implement option D — few-shot examples covering routing decisions and schema-compliant final outputs.

Exam Strategy

When a prompt-engineering question lists several implementation constraints, treat each one as a filter and eliminate options that violate any single constraint — per-request cues fail "minimize code changes," and vocabulary lists fail "clarify representative compound inputs." Then look for the option that demonstrably covers every reported defect; here only few-shot examples address both routing and output schema. Watch for keywords like "representative inputs," "examples," and "consistent format," which reliably signal few-shot pattern prompting over role or rule statements.

Frequently Asked Questions

Why don't system-level role instructions (option C) solve this problem?

Role instructions set abstract agent domains and task boundaries, which helps routing in principle, but they do not demonstrate how to decompose a specific compound request or enforce an exact response schema, so the inconsistent final format can remain.

Why is adding per-request prompt cues (option A) rejected?

Per-request cues must be injected by application code on every call, which violates the requirement to minimize code changes and does not provide one durable fix that applies to all future conversations automatically.

What should few-shot examples for this scenario include?

Include compound input/output pairs such as a request combining a data-analysis calculation with a literature summary, showing which agent is selected at each step and a schema-compliant final response with consistent section labels and prefixes.

More AI-500 FAQ →

Community Votes

D
100%

100% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 1 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 1

  1. ricopi 👍 1 Answered D
    Claude: I’d pick D, not C. The highlighted answer looks wrong to me. The deciding requirement is “clarify the expected behavior for representative compound inputs.” That describes few-shot examples: concrete input/output pairs that show the model what to do. D covers both problems: Routing examples fix the misrouting. Show a compound request like “calculate X and summarize the sources on Y,” then show it being split into a data-analysis task and a literature-review task. Schema-compliant output examples fix the inconsistent format, because the model copies what it’s shown much more reliably than what it’s told. D also meets the other two requirements: Minimize code changes: It’s a prompt change only. You edit the agents’ instructions in Foundry. Apply to every future conversation: The examples sit in the agents’ persistent instructions, so they apply to every conversation, not just one request.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to AI-500 Study Guide