Process input messages before they are sent to the LLM
Either:
Process the complete output result after streaming/generate is finished
Either:
Process output stream chunks with built-in state management This allows processors to accumulate chunks and make decisions based on larger context Return null or undefined to skip emitting the part
Mastra Processor implementing input/output policy gating — see the module comment for the phase/channel model.
Under
@mastra/core1.50, a final output result has no structured-object field. The constructor therefore requires an audit sink when a policy selectsobjectwithoutanswer. The first final-result call then emits one coverage warning for that engine instance. Policies that includeanswerinspect the JSON text emitted by direct structured output.The constructor also rejects an explicit input policy whose channels exclude
answer, because input evaluation has no other channel.