# Use the AI Agent block as logic for a flow The traditional method of performing logic in a flow uses a series of blocks. For example, you might get a response from an **HTTP Request** block and route the data to a **Select** block. The flow would process the selected data with an **Evaluate** block and send the result to a **Display** or **Output** block. This method can sometimes result in a complex system of blocks that perform your use case, but can be challenging to design and debug. With the **AI Agent** block, this process can use fewer blocks. You can route the response into a single **AI Agent** block, write a prompt to describe your business logic, and an AI model will handle the logic. You can also explain any data conversion in the prompt to handle that, too. ## Recipe The following recipe shows how to use an **AI Agent** block to get a list of GitHub issues from Postman's app support repo: 1. Create a flow and add an **HTTP Request** block. Leave the HTTP verb as `GET`, and enter the following URL: `https://api.github.com/repos/microsoft/vscode/issues` 2. Add an **AI Agent** block and connect its **key** input port to the **HTTP Request** block's **Success** port. 3. Select a **Model** for the **AI Agent** block. 4. Write a prompt that describes what to do. Prompt engineering is beyond the scope of this recipe, but a good strategy is to describe a persona, the task, the context, and the format of the result. For this recipe, use this prompt: You are a customer support manager named Joe Smith. Draft an email to your team at Example.com showing the first ten items in the body array in the provided list. For each item, provide a ten-word summary of the title and a one-sentence summary of the item's body. Make this a ten-item bulleted list, with each bullet the title and body summary. 5. Connect a **Display** block to the **AI Agent** block's **Result** port. 6. Run the flow. The **AI Agent** block generates an email as described in the prompt. ## Try it out To see this recipe's completed flow, check out [Cookbook: Use the AI Agent block as logic for a flow](https://www.postman.com/postman/flows-snippets/flow/68befbe6566b1a00131c22f2/). You can also [clone this flow](/docs/postman-flows/build-flows/create/clone-flows/) to your workspace to experiment with it.