Skip to content

Pick the best draft from an agent

At the end of this guide your coding agent will be able to write several drafts, ask Supposing which is best, and use the winner. It suits 2 to 8 short texts: replies, names, prompts, headlines.

You need the agent connected over MCP (Set up your agent).

compare_options takes the drafts and a rubric, and waits for the answer. The call below is what the agent sends:

{
"tool": "compare_options",
"arguments": {
"rubric": "Which reply to an angry customer is most likely to keep them? Prefer specific, short and honest.",
"options": [
"We're sorry. Your refund of $40 is on its way today, and here is a code for next month.",
"Thank you for reaching out! We value your feedback and will look into this.",
"Refund sent. Sorry about that."
],
"judge": { "provider": "mock", "model": "mock" }
}
}

Every option meets every other, in both orders: 3 options make 6 judge calls, 8 options make 56. With the default judge that is a few cents and usually 10 to 60 seconds. Leave out judge to use it; mock keeps this example free.

The answer starts with the verdict, for example “option 3 ranks first. 2 clear tiers.”, then the ranked options with their text. The options are named “option 1”, “option 2” and so on, in the order sent.

Add this to the agent’s instructions:

When you write several candidate drafts for the user, call the supposing compare_options tool with the
drafts and a one-sentence rubric of what "better" means here. Use the winner. If the verdict says the top
options are tied, show the user both.

The same thing from Python, for an agent that runs code:

from supposing.cloud import Client
drafts = [
"We're sorry. Your refund of $40 is on its way today, and here is a code for next month.",
"Thank you for reaching out! We value your feedback and will look into this.",
"Refund sent. Sorry about that.",
]
with Client() as sp:
items = [{"title": "option %d" % (i + 1), "text": d} for i, d in enumerate(drafts)]
ds = sp.datasets.create("reply drafts", items, ephemeral=True) # a one-off: kept out of your lists
run = sp.runs.create(ds.id, "Which reply is most likely to keep the customer?", provider="mock", ephemeral=True)
run = sp.runs.wait(run.id)
best = sp.runs.results(run.id)
print(best.summary)
print("Use:", drafts[int(best.leaderboard[0].title.split()[-1]) - 1])
  • compare_options for 2 to 8 short options; it waits and answers.
  • rank_documents for more or longer documents; it returns a run to follow with get_run and get_results.
  • Write the rubric as one sentence about what “better” means for this task.