The Evaluate block

View as Markdown

The Evaluate block is a powerful tool for manipulating and evaluating data. It’s ideal for filtering data, conditionally running parts of your flow, integrating complex logic, and validating data with tests.

Using TypeScript scripts or Flows Query Language (FQL) queries, you can set up the Evaluate block to process data and send the result. When using TypeScript, you can also define tests with the pm API (for example, pm.test()), and the block will output structured test results through a dedicated Tests port. You can also define evals with pm.eval methods to grade AI-generated output against qualitative criteria using an AI model as a judge, and the block outputs eval results through a dedicated Evals port. The Evaluate block has pre-defined snippets to help you create FQL queries.

Input

variable - Accepts data from another block’s output port.

Output

  • Result — Sends the result of the script or query.
  • Tests — Sends an array of test results when pm.test() is used in a TypeScript script. Each result includes the test name, pass/fail status, error details (if any), index, and whether the test was skipped.
  • Evals — Sends eval results when pm.eval methods are used in a TypeScript script. The payload has a results array and a summary object. Each entry in results has the eval’s id, label, kind (preset or custom), and status (pass, fail, or skipped). A graded entry also has score, threshold, and reason. A skipped entry instead has a skippedReason. The summary object includes the graded and passed counts, the average score, and the threshold. When every eval skips, graded, passed, and score are all 0.

Setup

The Evaluate block processes data it receives from its input ports and inserted data blocks.

When created, the Evaluate block has one input port. When you connect another block to this port, the Evaluate block inserts a Select block and assigns the selected value to a variable named value1. To rename the variable, click it and enter a new name.

You can also change the inserted Select block to a different data block by clicking the Flows select icon Select block’s icon and choosing a data block from the dropdown list.

You can also insert more variable data blocks into the Evaluate block to process their data. For example, you could insert a String block into your Evaluate block, name the variable string1, and reference it in your query as string1. Click Add data blocks Add data blocks to insert a data block into your Evaluate block.

The Evaluate block has a text box where you can enter TypeScript to create scripts or FQL to create queries. Click the dropdown list at the top of the block to set the text box to use TypeScript or FQL. Then click inside the text box and enter your code. When using TypeScript, you can define tests with the pm API (for example, pm.test() and pm.expect()) directly in the script. Test results are displayed in the Tests tab and sent through the Tests output port when the block runs. When the text box is set to use FQL, you can click Snippets and choose from a list of common tasks.

Flows can’t modify environment variables, including by using scripts in Evaluate blocks.

Define evals with pm.eval

When using TypeScript, you can define evals with pm.eval methods to grade AI-generated output against qualitative criteria, using an AI model as a judge. Use an eval instead of a test when grading the output requires interpretation rather than a definite pass or fail.

The pm.eval methods provide five preset criteria and a custom criterion. For what each criterion grades and the context it needs, see Eval criteria.

  • pm.eval.friendliness(output, options?)
  • pm.eval.safety(output, options?)
  • pm.eval.nonToxicity(output, options?)
  • pm.eval.correctness(output, options?)
  • pm.eval.relevance(output, options?)
  • pm.eval.custom(name, output, criterion, options?)

The options object accepts the following:

  • threshold — The score an eval must reach to pass, on a 0–1 scale. The default is 0.8. On the AI Agent block, the equivalent threshold is fixed at 80 on a 0–100 scale.
  • reference — A ground-truth answer for the judge to compare the output against. Correctness needs a reference to produce a score.
  • query — The prompt or question the output responds to. Relevance needs a query to produce a score.
  • context — A JSON-serializable object of key-value pairs. Reference a key in a custom criterion as {{key}}. Postman passes the values to the judge as structured data rather than interpolating them as strings, which protects against prompt injection.
  • model — A judge model ID to use instead of the default, gpt-5.4-nano-2026-03-17. An unrecognized ID falls back to the default judge model without an error. Other valid IDs are gpt-4o-mini-2024-07-18, gpt-4o-2024-11-20, gpt-4o-2024-08-06, gpt-4.1-2025-04-14, gpt-4.1-mini-2025-04-14, and gpt-4.1-nano-2025-04-14. This default differs from the judge model the AI Agent block uses, which is fixed at gpt-4o-mini-2024-07-18.

The Evaluate block gives the judge only the context you pass to a pm.eval method. The AI Agent block automatically adds the agent’s prompt and inputs as context, so a similar check can produce a different result on each block.

A script that uses pm.eval methods has the following limits. Each is applied as all-or-nothing: if a script exceeds one, no evals run.

  • Up to 50 pm.eval method calls per script run.
  • Up to 512 KiB total payload per script run.

The following values are truncated rather than rejected:

  • Graded output longer than about 46,000 characters is truncated to its prefix.
  • A criterion string longer than 4,000 characters is truncated.
  • A context field longer than 4,000 characters is truncated.

Evals are opt-in and consume Flows credits, with each enabled eval running as a separate judge call. Eval results appear as per-eval scores and reasons, in the All evals tab of the run log, and through the Evals output port. Evals run when the flow runs and aren’t supported by the Postman CLI. For details, see Evaluate AI output with evals. For step-by-step instructions, see Add evals to a flow.

Example

To see the Evaluate block in an example flow, check out Flow Snippets: Evaluate.

You can use the Condition and If blocks instead, depending on your use case.

You can insert the following blocks into the Evaluate block to process their data including the String, Bool, Number, Null, Select, Now, Date, Date & Time, List, Record, and Get Variable blocks.

For tutorials that use the Evaluate block, see the following: