Classify posts with a decision model in Workflows

AI-generated summary

sam provides a guide on using the Classify node in Discourse Workflows to automate post classification with decision models. These models, faster and cheaper than AI agents for binary or multiple-choice decisions, add probability-based answers to workflow items for downstream actions.

Prerequisites

  • Workflows enabled (Business/Enterprise plans).
  • A decision model configured (hosted sites have one by default).

Example Workflow: Flagging Auto-Replies

To flag automated ticketing emails as posts for review:

  1. Trigger: Set to Post created.
  2. Classify Node:
    • Use the configured decision model.
    • Set Text to {{ $json.post.raw }}.
    • Add a Yes/No question: auto_reply – “Is this an automated reply from a ticketing or help desk system, not a message written by a person?”
  3. If Node: Check if {{ $json.classification.auto_reply.probability }} > 0.9.
  4. Flag Post Node: On the true branch, flag the post using {{ $json.post.id }} and type Add post to review queue.

Question Types & Outputs

Answers are stored at classification.<name>. Use short, space-free names for referencing in expressions.

  • Yes/No: Returns probability (0–1).
  • Choice: Returns choice, probabilities, and confidence.
  • Score: Returns level, score (weighted value), probabilities, and confidence. Levels should be listed from lowest to highest.
  • Refusal: If the model declines, the answer includes type: refusal and a reason, with no probability.

Handling Images

Set the Images field to {{ $json.post.upload_ids }} to include post images, provided the decision model supports vision. Non-image uploads are ignored, and the node fails if an image cannot be sent.

EricGT](/t/-/418780/2) praised the practical clarity of the guide, suggesting that decision models could be a valuable topic for a webinar, noting the utility of factual details over abstract theory.

Configure a decision model | Related resources

:bookmark: This guide explains how to use a decision model in Discourse Workflows to classify posts and act on the answers.

:person_raising_hand: Required user level: Administrator

The Classify node asks a decision model questions about each item, such as a new post. It adds the answers to the item so later nodes can act on them.

Decision models return probabilities, not prose. They are faster and cheaper than an AI agent for yes/no and pick-one decisions.

Before you start

  • Workflows is enabled. It’s available on the Business and Enterprise plans.
  • A decision model is configured. Hosted sites have one already. Otherwise, see Configure a decision model.

The Classify node appears once a decision model exists.

Example: send help-desk auto-replies to review

When a user signs up with a help-desk address, notification emails can come back as posts like “Your ticket has been created”. This workflow sends them to the review queue.

  1. Create a workflow with the Post created trigger.

  2. Add Classify:

    • Decision model: your model
    • Text: keep the default, {{ $json.post.raw }}
    • Add a question:
      • Name: auto_reply
      • Type: Yes/no
      • Question: “Is this an automated reply from a ticketing or help desk system, not a message written by a person?”

  3. Add If: {{ $json.classification.auto_reply.probability }} greater than 0.9

  4. On the true branch, add Flag post:

    • Post ID: {{ $json.post.id }}
    • Flag type: Add post to review queue
  5. Publish.

Check the execution log for a few days and adjust the threshold.

Question types

Each answer is added at classification.<name>. Use short names without spaces, because you reference them in expressions.

Type Use it to Answer
Yes/no Test one condition probability: chance of yes, from 0 to 1
Choice Pick one label choice, probabilities, confidence
Score Rate on a scale level, score, probabilities, confidence

For Score, list levels from lowest to highest. score is a weighted value starting at 0 for the first level.

If the model declines a question, that answer has type set to refusal and a reason. It has no probability.

Images

Set Images to {{ $json.post.upload_ids }} to include the post’s images. The model needs image support. Uploads that aren’t images are ignored. If an image can’t be sent, the node fails instead of answering without it.

Additional resources

1 Like

Thanks for the brief summary.

Expanding on explaining Decision Models into a webinar might be of interest to others. :light_bulb:

Personally, it’s these posts on decision models where I get the factual details and practical information, rather than just theory. I find that particularly valuable.

Thanks for sharing.

1 Like