Approval pipelines
How approval pipelines decide what happens next for a request.
An approval pipeline is a series of blocks that runs on a request to decide what happens next. Blocks can check request fields, ask a model or service, return a fixed outcome, or run a set of blocks only for the requests that need them.
Blocks
Blocks run one at a time, in order. Each block can do one of four things.
| Outcome | What happens |
|---|---|
| Approve | The request is approved and the pipeline stops. |
| Deny | The request is denied and the pipeline stops. |
| Ask for human review | The pipeline stops and the request goes to human review. |
| Continue | The request moves to the next block. |
An Always block returns the outcome you choose for every request that reaches it. It is useful as the last block to handle everything earlier blocks passed on. Nothing below it runs. See Always blocks to set one up.
A Branch block holds its own blocks and runs them only for requests that match its condition. Every other request skips the branch and moves on to the next block. A request that enters a branch is settled there: if none of the branch's blocks decides, it goes to human review, and nothing after the branch runs. See Branch blocks to set one up.
Pipeline evaluation
Pipelines are evaluated in the same order each time, split into two stages: the organization pipeline and the agent pipeline.
The organization pipeline is global across your organization. It runs first for every request from every agent.
Each agent has exactly one agent pipeline, shared by all its instances. If the organization pipeline passes a request on, it goes to that agent's pipeline. A request never goes through a different agent's pipeline.
If the organization pipeline approves, denies or asks for human review, processing stops there. The agent pipeline doesn't run.
If neither pipeline decides, the request needs human review. Whenever a request needs a human, an escalation path handles who is contacted.
Loading diagram…
Diagram source
flowchart TD
request["Request"] --> organization["Organization pipeline"]
organization --> organizationDecision["Approved or denied"]
organization -->|Continue| agent["Agent pipeline"]
organization --> organizationReview["Human review"]
agent --> agentDecision["Approved or denied"]
agent -->|Ask for review or no decision| agentReview["Human review"]This split lets you define rules for a tool across the organization, as well as rules for individual agents.
For example, your payments team might be responsible for reviewing every Stripe request that comes into withHuman. That rule can live in the organization pipeline, so every Stripe request goes to them, regardless of which agent sent it.
The agent pipeline is where the people who own an individual agent define rules for that agent's work. Requests that the organization pipeline passes on are handled by those rules.
An example: issuing a refund
Imagine an agent called Support assistant handles your refunds. You could set up these blocks, in this order.
- Organization pipeline: deny refunds over $500.
- Support assistant pipeline: approve refunds up to $20.
- Support assistant pipeline: ask for human review for refunds over $20, up to $500.
Loading diagram…
Diagram source
flowchart TD
request["Refund request from a Support assistant instance"] --> limit
subgraph organization["Organization pipeline"]
limit["Deny refunds over $500"]
end
subgraph agent["Support assistant pipeline"]
small["Approve refunds up to $20"]
larger["Ask for human review over $20, up to $500"]
small -->|Continue| larger
end
limit -->|Matches| denied["Denied"]
limit -->|Continue| small
small -->|Matches| approved["Approved"]
larger --> review["Human review"]An instance of Support assistant asks to refund $75. The organization block passes it on because it's under $500, so it goes to the Support assistant pipeline. Its first block passes it on too, because it's over $20. The next block asks for human review, so an escalation path brings in a reviewer to approve or deny the refund.
A $10 refund gets approval from the first block in the Support assistant pipeline. A $600 refund gets denied by the organization block, before the Support assistant pipeline runs.