> For the complete documentation index, see [llms.txt](https://docs.laminar.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.laminar.run/building-an-integration/advanced/workflows/workflow-exit-points.md).

# Workflow Exit Points

Learn how to stop a workflow execution gracefully

When building integrations, you may wish to terminate a workflow early if some preconditions are not met.

Laminar solves this with the `lam.exit` keyword which can be used to stop a workflow execution and optionally return a payload providing more context on the exit.

```javascript
(payload) => {
  const { step_1 } = payload;
  if (step_1.inventory.quantity < 1) {
    return {
      "lam.exit": true,
      // payload to be returned
      "data": { 
        "error": "Out of stock"
      }
    };
  }
  // Continue with normal processing...

```
