***
title: The AI Agent block
updated: 2025-12-01T00:00:00.000Z
topictype: reference
slug: docs/postman-flows/reference/blocks/ai-agent
max-toc-depth: 2
----------------
The **AI Agent** block is an AI assistant that can automate tasks in Postman Flows. It responds to natural language prompts by analyzing data, generating content, making decisions, and calling other flows.
The **AI Agent** block uses one of several AI models to interpret prompts and act on available context. You can pass data to the block as variables in the **Context** section, and each variable's *label* helps the block understand the variable's purpose. The **AI Agent** block can also use other flows as *tools* to complete its tasks.
For example, you could give the **AI Agent** block a list of API endpoints as a variable named **endpoints\_list**. Then, you could select a flow from the **Tools** section that sends a GET request to a provided endpoint. When you prompt the **AI Agent** block to “Get the content headers for each endpoint in endpoints\_list,” it will automatically run the tool for each one and output the results.
## Input
{/* vale postman-style-guide.Terms = NO */}
{/* Getting vale errors for "click" */}
**Context** - Variables you can reference in your prompt using plain text. The variable's name is called a *label* here because the **AI Agent** block interprets context about the variable’s value from the its label. For example, an **endpoints** label provides more context than a label like **variable-1**. Click
**Add data blocks** to add more variables. You can add variables to the **Context** section using any of the following data blocks:
* [**String**](/docs/postman-flows/reference/blocks/string/)
* [**Bool**](/docs/postman-flows/reference/blocks/bool/)
* [**Number**](/docs/postman-flows/reference/blocks/number/)
* [**Select**](/docs/postman-flows/reference/blocks/select/)
* [**Get Variable**](/docs/postman-flows/reference/blocks/get-variable/)
* [**Get Configuration**](/docs/postman-flows/reference/blocks/get-configuration/)
## Outputs
**Result** - Sends the result of the **AI Agent** block's task.
## Setup
**Model** - Select the AI model from the dropdown list that best suits your task. Different models consume different amounts of credits. See [Manage your team's Postman Flows credit usage](/docs/billing/flows-usage/#how-flows-consume-credits) for details about how the **AI Agent** block consumes credits.
**Prompt** - The *system prompt* for the AI agent. A system prompt is static and persists for the duration of the task. Enter a prompt in natural language that describes what you want your agent to do. You can reference variables in the prompt by including the variables' labels as plain text. If you added tools to the block, the **AI Agent** block will automatically use them if needed to act on the prompt.
**Tools** - Tools are flows your **AI Agent** block can run automatically. The **AI Agent** block tries to generate any input data it needs from its own knowledge or from variables you've provided. To use a flow as a tool, the flow must have at least one [snapshot](/docs/postman-flows/build-flows/configure/snapshots/).
To add a tool, do the following:
1. Click the **AI Agent** block.
2. Click **Add a tool**.
3. Select a tool from the dropdown list.
To select a different snapshot of a tool, do the following:
1. Hover over the tool.
2. Click
.
3. Select a snapshot from the dropdown list.
When a tool uses [inputs](/docs/postman-flows/build-flows/configure/scenarios/), the **AI Agent** block will automatically populate those inputs with AI-generated data. You can also assign static values to the inputs with a [*configuration*](/docs/postman-flows/build-flows/configure/configure-values-actions/).
Postman Flows doesn't pass static configuration data to the LLM to preserve the security of any secrets.
To select a configuration for a tool, do the following:
1. Hover over a tool.
2. Click
**Edit Tool**.
3. Next to the input, click
**AI-generated**.
4. Select a configuration from the dropdown list or click
**Add configuration** to create a new one.
**Additional Settings** - Appears when you click the block, and enables you to select an AI model or enforce an output schema that you can parse later in the flow.
To enforce an output schema, do the following:
1. Click the **AI Agent** block, then click
**Additional Settings**.
2. Click
**Enforce output schema >
Schema**.
3. Click **Generate from example** and paste valid JSON data into the text box, then click **Generate schema**. Alternatively, click **Define custom schema** to manually enter a JSON schema.
## Related blocks
* [**AI Request**](/docs/postman-flows/reference/blocks/ai-request/)
* [**Bool**](/docs/postman-flows/reference/blocks/bool/)
* [**Create with AI**](/docs/postman-flows/reference/blocks/create-with-ai/)
* [**Get Configuration**](/docs/postman-flows/reference/blocks/get-configuration/)
* [**Get Variable**](/docs/postman-flows/reference/blocks/get-variable/)
* [**Number**](/docs/postman-flows/reference/blocks/number/)
* [**Select**](/docs/postman-flows/reference/blocks/select/)
* [**String**](/docs/postman-flows/reference/blocks/string/)