Font Size:
Ask Joget AI

Response Condition

Introduction

The Response Condition evaluates the agent's output against an ordered list of rules and routes execution to the correct next step based on what the response contains.

What it does

A Response Condition sits on a task and watches what that task produces. After all the Enhancers on the task have run, the Response Condition checks the response text against each route you defined, in the order you defined them. The first route whose condition matches determines what happens next.

You define routes as rows in the Routes grid. Each row pairs a condition with an action. If no route matches, execution moves on to the next task as normal.

The available condition types are listed in the table below:

Condition type What it checks
Contains / Does Not Contain Whether a word or phrase appears in the response.
Equals / Does Not Equal Whether the response is an exact text match.
Matches Regex Whether a Java regular expression matches anywhere in the response.
LLM Eval Asks the task's LLM a yes-or-no question about the response content and routes based on whether it answers yes.
Always Matches unconditionally. Use this as the final catch-all row.

The available actions are listed in the table below:

Action What the agent does
Continue Proceed to the next task (the same as no match).
Abort Stop the agent run immediately.
Go to Task Jump to a specific task by its ID.

Get started

How to use it

To use the Response Condition Element, follow these steps:

  1. Locate the Response Condition element under the Decisions section in the palette.
  2. Drag and drop the element into the Drop a decision rule to here section.

Configure Form Properties

To properly integrate and configure the Beanshell, set the following fields:

  • Personalized Names: Specify a name for the response condition.
  • Routes: Click Add. Define one or more if-then routes evaluated in order. The first matching route wins; if none match, execution continues to the next task. Required field.
    • Condition: Select one of: Contains, Does Not Contain, Equals, Does Not Equal, Matches Regex, LLM Eval, Always.
    • Value / LLM Question: For Contains and similar: the text to look for. For Matches Regex: a Java regular expression. For LLM Eval: the yes-or-no question to ask. Leave blank for Always.
    • Action: Select Continue, Abort, or Go to Task.
    • Target Task: The task to jump to when the action is Go to Task. Select from the dropdown, which lists all tasks in the agent. Leave blank for other actions.
Route ordering matters

Routes are checked in order. Put the most specific conditions first and use Always as the last row if you want a guaranteed fallback action.

Samples

Error sentinel, abort on detected failure
Route 1:
  Condition: Contains
  Value: ERROR:
  Action: Abort

Route 2:
  Condition: Always
  Action: Continue
Quality loop, retry until the answer is complete
Route 1:
  Condition: LLM Eval
  Value: Is this a complete and accurate answer?
  Action: Continue

Route 2:
  Condition: Always
  Action: Go to Task
  Target Task: Refine Answer

Best Practices

  • LLM Eval uses the task's own LLM service. There is no separate model configured for the evaluation step. If the task LLM is slow or expensive, LLM Eval adds that cost for every invocation.
  • LLM Eval checks for "yes" at the start of the model's reply. The system prompt instructs the model to answer only yes or no, and the match is case-insensitive. Short, clear questions give the most reliable results.
  • Matches Regex uses Java pattern syntax. To match case-insensitively, embed the flag in the pattern: (?i)your pattern. The pattern is tested with find(), so it matches anywhere in the response.
  • Only one Decision can be attached per task. If you need to combine routing logic, express it as multiple routes in the grid rather than stacking two decisions.
  • Go to Task requires a valid task ID. Use the dropdown selector in the Target Task column to pick from the tasks that exist in the agent rather than typing an ID by hand.
Created by Debanraj Ravindran Last modified by Debanraj Ravindran on Jul 08, 2026