# Connecting bricks and branching Every output of every brick must lead to exactly one brick or to End scenario before you can publish; a brick can take any number of incoming connections. ## Connect two bricks 1. Drag from the dot at the right of an output to the header of the next brick. 2. Each output leads to exactly one brick. Several outputs can share one target, for example one fallback for **Invalid** and **Empty**. 3. With **Smart connections** on, drop an output on an empty part of the canvas to send it to **End scenario**. Instead of a long line, the output shows a small **End** tag. 4. To reconnect an output that ends in **End**, click its **End** tag: the connection is highlighted and a red **×** appears. Click **×**, then drag the output to the new brick. Dragging an output that is already connected moves the brick instead. 5. **Auto-layout** (bottom left) arranges all bricks left to right. Fit to screen (⛶) shows the whole flow. ## Three ways to branch | Branch on | Brick | Outputs | | ------------------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------- | | What the caller said, against fixed answers | [Question](https://docs.aiva.apifonica.com/guides/bricks/question/) | One per answer, plus Invalid, Empty, Incomplete | | A free dialogue with a language model | [AI question](https://docs.aiva.apifonica.com/guides/bricks/ai-question/) | One per skill, plus Error, Empty, Incomplete | | Values of variables | Conditions | One per condition group, plus Otherwise | ## Patterns that keep callers out of dead ends - **Reprompt once.** Send **Invalid** and **Empty** to a short text-to-speech reprompt whose **Complete** goes back to the same Question. - **Vary the reprompt.** An Audio sequence in **One by one** mode plays a different message each time the brick is reached. - **Fail to a person.** Connect error outputs of HTTP request and Call transfer to a path that ends politely, such as an apology or a transfer. - **Close every Incomplete.** Incomplete usually means the caller hung up; send it to End scenario, or to an SMS brick that follows up after the call. A loop has no limit of its own; a call can last up to 60 minutes.