Build a flow and publish it

Start a flow from a template or an empty canvas, connect a model, publish the flow and bind the operation code your requests will name.

3 min read

A flow decides what a request may spend and how it is answered. This page walks through the shortest flow that works — a request comes in, a model answers it, a refusal is answered as a refusal — from an empty canvas to the first request.

Two things come first. The project needs a connection to the provider of the model the flow will call — Connections. And building flows needs the flows:write permission — Organizations, projects and roles says which roles have it.

The flow you are building

  • Request — Default → AI Model
  • AI Model — Success → Return Response
  • AI Model — Deny → Reject Request

The request enters at Request, AI Model calls the model, and Return Response answers with what the model said. When a budget or a policy refuses the call, AI Model leaves through Deny and Reject Request answers the refusal.

To start from a ready rule instead, pick a card on Templates and press Create draft — AI flow templates — then read its nodes and go on from Check the flow.

Build and publish

1. Create the flow

On AI Flows press New flow, fill in Name and press Create flow. The builder opens with an empty canvas.

2. Add the nodes

Press Add node and drag four nodes onto the canvas: Request, AI Model, Return Response and Reject Request.

3. Connect them

Drag from the port of Request to AI Model. Then connect the Success port of AI Model to Return Response, and its Deny port to Reject Request.

4. Choose the model

Press AI Model and choose the Model. Leave Provider pool as it is: the call then goes through the default pool of the provider, or through your connection to it. Max output tokens caps the answer, and the hold is sized on it.

5. Word the refusal

Press Reject Request and set the Error code and the Message the caller gets when the spend is refused, for example budget_exceeded.

6. Check the flow

Press Validate. A problem is marked on its node, and the panel of the node says what to change. A warning does not stop the publish: this flow is warned that AI Model has no Error branch, so a provider error fails the request.

7. Publish it

Press Publish. The draft becomes version 1, the active version of the flow.

8. Bind the operation code

Open the Settings tab of the flow. Under Operation binding type the code your application will send into Operation code, such as generate_email, and press Save binding.

The changes are saved as you make them, so the builder can be left at any step and the draft is there when you come back — Flow builder.

Send the first request

A request that names the bound operation code runs the flow. Quickstart sends one from PHP or Node.js. The Executions tab of the flow then lists it, and Inspect an execution shows how to read it.

To change the flow later, edit it in the builder and publish again: requests go on running the active version until the next publish — Publish, versions and rollback.

Where to go next

  • Flow builder — the palette, the canvas and the panel of a node.

  • How a flow is built — every node of the palette and what every flow must have.

  • AI flows — how a request finds its flow.

  • AI Model — what the model node does with the money of a call.