Microsoft-Decision-1: gate a text brief before a paid Sume video job

Send the brief to Decision-1 as a choice question, render only on 'render', and fail closed on any error. Python sample using the Foundry systemone path.

5 min readSume
All posts

To gate a Sume video job with Microsoft-Decision-1, send the brief as the state of a choice question with three options (render, review, reject), and submit to Sume only when the model picks render. Any HTTP error, timeout or unexpected option should return review, so a broken gate never turns into a paid render. The sample below is the whole gate.

The gate

Microsoft's Learn page says to post to <resource endpoint>/providers/microsoft/v1/systemone, to set model to your deployment name (not the underlying model name), and to authenticate with Entra ID or an api-key header. The response answers object is keyed by your question names, and a choice answer carries the selected option. Set AZURE_ENDPOINT, DEPLOYMENT_NAME and AZURE_API_KEY first.

import json, os, urllib.request

OPTIONS = {
    "render": "One clear subject, a length and a ratio, safe to render now",
    "review": "Missing a subject, length, or ratio; a person should look",
    "reject": "Not a video request at all",
}

def decide(brief: str) -> str:
    body = {"model": os.environ["DEPLOYMENT_NAME"], "state": brief,
            "questions": {"gate": {"type": "choice",
                "instructions": "Is this brief ready to render as one short video?",
                "criteria": OPTIONS}}}
    req = urllib.request.Request(
        os.environ["AZURE_ENDPOINT"].rstrip("/") + "/providers/microsoft/v1/systemone",
        data=json.dumps(body).encode(),
        headers={"Content-Type": "application/json", "api-key": os.environ["AZURE_API_KEY"]},
        method="POST")
    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            choice = json.load(resp)["answers"]["gate"].get("choice")
    except Exception:
        return "review"  # fail closed
    return choice if choice in OPTIONS else "review"

if __name__ == "__main__":
    print(decide("9:16, 8 seconds, a ceramic mug on a walnut table, slow push-in"))

What happens after render

Only then call Sume. `POST /v1/videos` answers 202 with an id and a polling_url; send an Idempotency-Key derived from your own order id, so a retry returns the original job instead of a second charge. If the balance cannot cover the reserve, you get 402 insufficient_credits with details.required_credits and details.available_credits before provider work starts, and the gate cost you nothing on the Sume side.

Where each failure is handled, Sume docs and Microsoft Learn read 2026-10-13
FailureHandled byWhat to do
Brief is vagueDecision-1 returns reviewAsk the author for subject, length, ratio
Decision call times out or returns 5xxYour try/exceptTreat as review, do not render
Decision call returns 429Microsoft's table says retry with backoffBack off, then retry the gate
Balance too lowSume 402 insufficient_creditsTop up or shrink the request; same key on retry
Queue fullSume 429 queue_fullWait for jobs to finish; same key on retry

Caveats

The Learn page warns that wording and option order can move the scores, that the model gives no rationale, and that you should validate on labelled examples before automating a gate. Do not use the gate as the sole decision about people. For a brief about a product shot, the cost of a wrong review is one human glance.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume