DEV Community

Mostafa Gazar
Mostafa Gazar

Posted on Originally published at Medium AI-assisted

Stop asking one prompt to do three jobs

Adapted from the first lesson of Designing Multi-Agent Systems on Learnvoro. Originally published on Medium.

Most AI workflows start as one long prompt: read this document, decide what matters, write the response. It works on the easy cases. Then the edge cases arrive, and it fails in ways that are hard to spot: a summary that quietly includes a penalty the source never mentioned, or a judgment shaped by the draft the model was already writing.

The cause is the design, not the model. When one context holds competing goals (stick to the facts, make a call, write persuasively), each pulls on the others. The fix is to split the work.

Diagram comparing one prompt that extracts facts, judges what matters and drafts the response, with three agents in a chain: an extraction agent passes facts.json to an assessment agent, which passes decision.json to a drafting agent.

One agent, one job

Give each agent a single transformation. A compliance review that used to be one prompt becomes three agents:

  1. An extraction agent pulls the facts of an incident out of the source into fixed fields.
  2. An assessment agent decides whether those facts cross a threshold, such as materiality, working only from the extracted fields.
  3. A drafting agent writes the response from the assessment.

The assessment agent never sees the raw document, so its tone can’t sway the decision. The extraction agent never sees the draft, so drafting can’t leak into the facts.

Write anti-goals, not personas

“You are a meticulous legal auditor” sounds strict and constrains almost nothing. An auditor persona will still offer advice, rewrite a sentence or fill a gap with a guess. What works is a list of things the agent must never do. For the extraction agent:

  • Never state a fact the source doesn’t contain; use null when a field is missing.
  • Never judge whether something matters.
  • Never rewrite, summarise or soften the source’s wording.
  • Never add a field the schema doesn’t have.

An anti-goal can be tested: you can check an output against it. A persona can’t.

Diagram comparing a persona prompt, "You are a meticulous legal auditor", which still offers advice, rewrites sentences and guesses, with four anti-goals: never state a fact the source doesn't contain, never judge whether something matters, never rewrite the wording, never add a field the schema doesn't have.

Hand over a contract, not the conversation

It’s tempting to pass each agent the whole chat so far. That costs tokens and brings back the contamination you split the work to avoid. Instead, each agent receives a fixed JSON payload and returns one:

{
  "incident_date": "2026-03-14",
  "systems_affected": ["billing"],
  "records_exposed": 12000,
  "data_types": ["email address", "postal address"],
  "source_quotes": ["Unauthorised access to the billing database was detected on 14 March."]
}
Enter fullscreen mode Exit fullscreen mode

Validate the payload at every handoff. If a key is missing or has the wrong type, stop there rather than letting the next agent guess.

Write the spec before the prompts

Before writing any prompt, fill in one row per agent: its role, what’s in scope, its anti-goals, the input it accepts and the output it guarantees. The course calls this an Agent Specification Matrix. For the extraction agent:

  • Role: turn the source into fixed facts.
  • Scope: the source document only.
  • Anti-goals: the four above.
  • Input: the source text.
  • Output: the JSON payload above, validated.

Table, an Agent Specification Matrix with one row each for the extraction, assessment and drafting agents, and columns for role, scope, anti-goals, input and output.

Most design mistakes show up here, such as two agents with the same job or an output nobody uses, while they’re still cheap to fix.

Don’t split too far

Every handoff is another place for things to go wrong. Split where goals compete, and no further: three agents with clear contracts beat eight with blurry ones. Test each agent on its own, with fixed inputs, before you run them together.


This post was written with help from AI.

Top comments (0)