Branching on Approval: Building Approval Workflows

An approval step on its own simply pauses the automation and collects a decision. The real power comes from pairing it with an if step that routes execution based on that decision. This article walks through the complete pattern for building an approval workflow in Chase Agents.

Step 1: Prepare the Context

Before the approval step, your automation should have already gathered and processed whatever data the approver needs to make an informed decision. For example, if you are asking for approval to send an email campaign, run the steps that generate the email draft first. Store the result so you can reference it in the approval message body.

Step 2: Add the Approval Step

Add a seek_human_approval_for_next_step step. Configure the recipient email, subject, and a message body that references the data from prior steps. The message should clearly state what the approver is being asked to approve and what will happen if they click Approve versus Reject.

When the approver receives the email and clicks a button, the step completes. The automation continues to the next step with the result available in dataPrev: the dataPrev.choice field holds the string value Approve or Reject, and dataPrev.message holds any optional free-text comment the approver added.

Step 3: Branch with an If Step

Immediately after the approval step, add an if step. Set its condition to check whether dataPrev.choice equals the string Approve. Define two branches: the true branch for the approved case where you continue with the action that required approval, and the false branch for the rejected case where you handle the rejection gracefully such as logging the decision and notifying the original requester.

Accessing the Approver's Message

If the approver left a comment when they clicked Approve or Reject, it is available in dataPrev.message. You can incorporate this into your rejection notification or use it to conditionally adjust what happens next. For example, if the approver noted a specific change request, you might include that instruction in a subsequent run_sandboxed_code step that finalizes the content before sending.

Multiple Approval Gates

You can add more than one seek_human_approval_for_next_step step in a single automation. For example, a content publishing workflow might require a writer's manager to approve the draft, and then a separate compliance reviewer to sign off before publication. Each approval step can route to a different email address and contain a different message body.

Timeout Handling

If no response arrives within the configured timeout window, the step resolves with the default outcome. Most workflows should treat a timeout as a rejection: stop the automation and notify stakeholders that the action was not approved in time. Avoid automations that default to Approve on timeout, as this creates a window where inaction inadvertently permits consequential actions.

Practical Example: Invoice Approval Workflow

A typical invoice approval automation might work as follows: step one fetches new invoices above a threshold from an accounting system; step two generates a formatted summary of each invoice; step three is a seek_human_approval_for_next_step that emails the finance manager with the invoice details; step four is an if step that checks whether dataPrev.choice equals Approve; the approved branch marks the invoice as approved in the accounting system and notifies the vendor; the rejected branch flags the invoice for manual review and notifies the accounts team.

Viewing Approval History

Every automation run that included an approval step is logged in Workflow History. You can see when the approval request was sent, when the approver responded, what their decision was, and any message they provided. This audit trail is available to workspace admins and is useful for compliance reviews.