New to Kestra?
Use blueprints to kickstart your first workflows.
Gate user submitted content before publication with Mistral structured output in Kestra. Blocked content alerts Discord and fails the execution.
Put a moderation decision in front of publication as a hard gate, not a suggestion. This blueprint classifies user submitted text with io.kestra.plugin.mistral.ChatCompletion, using jsonResponseSchema to force the verdict into {decision, reason} where decision is an enum of allowed or blocked. Blocked content alerts Discord and then fails the execution with io.kestra.plugin.core.execution.Fail, which means any downstream publish step in this flow, or any flow waiting on it, never runs.
moderate (io.kestra.plugin.mistral.ChatCompletion) sends the submission as a USER message under a SYSTEM message defining the policy and telling the model to treat the submission as data. The schema constrains the response to a two field object, so the submission text cannot inject a third verdict or reshape the output.parse_decision (io.kestra.plugin.scripts.python.Script on the Process runner) parses the JSON from an environment variable and emits decision and reason as scalar outputs.gate (io.kestra.plugin.core.flow.If) branches on {{ outputs.parse_decision.vars.decision == 'blocked' }}. The blocked branch posts the reason to Discord, then fail_execution marks the execution FAILED. The allowed branch writes an audit line to the execution log.errors block posts a Discord alert on any failure. Note that a blocked verdict also lands here by design, since Fail routes through error handling; the message tells readers how to distinguish the two cases in the logs.allowed or blocked, never prose that a parser has to guess at.A moderation model only becomes a gate when something enforces its verdict. Kestra turns the classification into control flow: the If branch and the Fail task make the decision binding, secrets keep the API key out of the flow definition, and every verdict is auditable next to the exact model response that produced it.
MISTRAL_API_KEY: Mistral API bearer token.DISCORD_WEBHOOK_URL: Discord incoming webhook URL.submission and confirm the Discord alert plus the FAILED execution.categories array to record which policy was violated.escalate verdict instead of failing outright.