Back Home

GitHub Repo

Dify Proposes a Draft for Moderating Streaming Output Before Release, Outlining the Limits of Chunk-by-Chunk Review

On November 4, the Dify community proposed optional synchronous moderation that checks streaming text before sending it in some applications. The proposal has not been merged and does not cover every output channel, including Agent, voice, and workflow events.

The original uploader was Ggia at Greek Wikipedia. · CC BY-SA 2.5 · Image source
zh-Hant

On November 4, the Dify community submitted a draft proposal for moderating streaming output, aiming to narrow the gap in which text reaches users before background moderation later replaces it. As of this review, PR #45536 remains a draft. Maintainers have yet to decide on the setting name or whether it should apply deployment-wide or per application. Proposal

Dify’s existing toolkit can moderate input, output, or both, and supports moderation models, keywords, and custom endpoints. This proposal changes when content is delivered: after MODERATION_OUTPUT_MODE=blocking is set, applicable applications buffer text and send the accumulated answer to a moderation service. The text is released only after it passes review. The default remains asynchronous mode. Official toolkit documentation, draft

This design directly affects latency and service costs. The first text chunk must wait until the buffer reaches a threshold or the answer ends, plus one moderation call; each subsequent chunk must also wait for review. Because the accumulated answer is sent each time, the moderation input grows as the answer gets longer. The proposal also acknowledges that later text could make previously approved text noncompliant. As a result, already released text may still be replaced, and the design cannot guarantee that none of an answer ultimately judged problematic will be exposed. Latency and limitations

The protection scope is also limited: the draft intercepts only message text events, while Agent applications retain their existing behavior. Voice, reasoning chunks, files, and some workflow events are out of scope. Stopping the response stream also does not cancel the model call or workflow running on the server. Application integrators will need to check each output channel they actually use. Draft limitations

The handling of external moderation services also warrants verification. An existing Alibaba Cloud Dify integration example truncates long outputs to the most recent 2,000 characters before submitting them for review. This suggests that even when Dify sends the accumulated answer, an endpoint may not review the full context. Engineering teams should next examine moderation coverage, matches spanning multiple chunks, and behavior when the service fails, while awaiting maintainers’ confirmation of the design and release version. Alibaba Cloud integration documentation

Sources

  1. Dify PR #45536:選用式串流輸出阻擋審查草案
  2. Dify App Toolkit:內容審查功能
  3. AI Guardrails:與 Dify 平台整合
  4. Dify PR #45535:保留非 ASCII 固定分隔符
  5. Dify Issue #45532:固定分隔符的 Unicode 解碼問題
  6. Configure the Chunk Settings