> ## Documentation Index
> Fetch the complete documentation index at: https://docs.budecosystem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Building an agent

> Create an agent, write its prompt and messages, and add variables and structured input and output.

**Who:** an agent builder with Model manage permission, in a project that has a running deployment

![Choose the agent type.](https://mintcdn.com/budecosystem-b7b14df4/tm7AvlRzpE_EcnqL/images/product-guide/agent-type.jpg?fit=max\&auto=format\&n=tm7AvlRzpE_EcnqL\&q=85\&s=c0857512d620e5e668a914aa24e7fcda)

Choose the agent type.

![The agent builder: input, system prompt, messages and output.](https://mintcdn.com/budecosystem-b7b14df4/tm7AvlRzpE_EcnqL/images/product-guide/agent-builder.jpg?fit=max\&auto=format\&n=tm7AvlRzpE_EcnqL\&q=85\&s=ae01b1262c9b02ef9c706a4acccddb93)

The agent builder: input, system prompt, messages and output.

An agent is a prompt, a model and a set of rules for how it runs. You build it in the agent builder, test it in the same window, and ship every change as a new version. Callers pick an agent by name, and optionally by version.

## Before you start

* The project needs at least one running deployment of a text model. The agent runs on it.
* You need **Model manage** permission in the project to create or change agents. **Model view** lets you open and read them.
* An agent has a **name** (the **Deployment Name** you choose when you create it) and numbered **versions**. Callers use the name as `prompt.id`.

## Create an agent

**Who:** Model manage permission in the project

**Where:** Agents → + Agent

1. **Select Projects**: choose the project and click **Next**.
2. **Select Agent Type**: choose **Agent** (a prompt-based agent) and click **Next**. **External Agent** registers a remote A2A agent instead ([Giving agents tools and skills](https://docs.budecosystem.com/prompts-agents/tools-and-connectors.md)). **Agent Workflow** is shown but not yet available.
3. The agent builder opens with one agent box, **V1**. Click **Load Model** in the box header and pick the deployment the agent runs on.
4. Click the **System Prompt** card and write the instructions.
5. Optionally, on **Prompt Messages**, add example messages.
6. Click **Save** in the box header.
7. Fill in **Agent Configuration** (table below) and click **Next**.
8. If the platform found configuration warnings, review them and choose **Back** or **Proceed Anyway**. The success step shows the agent's URI.

### Agent Configuration fields

| Field | What to enter | Rules and defaults |
| - | - | - |
| **Deployment Name** | The agent's name for callers, for example `claims-assistant`. | Required. Must be unique. Callers send it as `prompt.id`. |
| **Tags** | Keywords to organise and find the agent. | Optional. Type a tag and press Enter. |
| **Description** | The agent's purpose and capabilities. | Optional. |
| **A2A Configuration → Organization** | The provider organisation shown on the agent card, for example `Bud AI`. | Optional. |
| **A2A Configuration → URL** | The provider's web address. | Optional. |
| **A2A Configuration → Documentation URL** | A link to the agent's documentation. | Optional. |
| **A2A Configuration → Skills** | Click **Add Skill** to describe what the agent can do for other agents. | Optional. Each skill has an **ID**, **Name**, **Description**, **Tags**, **Examples**, **Input Modes** and **Output Modes** (for example `application/json`). They appear on the **Agent Card** tab. |

> [!TIP]
>
> You can hold at most three agent boxes in the builder at once. Opening a fourth shows "Maximum of 3 agent boxes allowed".

## The builder's four cards

The builder shows **Input**, **System Prompt**, **Prompt Messages** and **Output** as cards. Click a card's expand icon (**Expand system prompt**, **Expand input settings** and so on) to open the full-screen editor, which has one tab per card: **Input**, **System Prompt**, **Prompt Message** and **Output**.

### System prompt

The system prompt is the standing instruction the model sees on every call. The compact card is a plain text box (*Enter system prompt...*) that you can resize. The expanded editor adds:

* **Syntax colouring** for `{{ variable }}` (a value), `{% if %}` (logic) and `| filter` (a transform). The prompt is a Jinja template, so you can use conditions and loops.
* **Find and replace**, including replace-all.
* **Insert variable**, and an autocomplete that opens when you type `{{`.
* A **Variables** panel on the right that lists every variable found in the text with its type and how many times it is used, and an outline of the prompt's sections.

### Prompt messages

Prompt messages are fixed example turns that come before the caller's message. Use them to show the tone or format you expect.

| Field | What to enter | Rules and defaults |
| - | - | - |
| **+ Add Role** | Adds the next message. | The role is positional, not chosen: the first message is **User**, the next **Assistant**, and so on, alternating. Deleting a message re-labels the ones after it. |
| **User Message / Assistant Message** | The text of the turn (*Enter Message*). | Accepts `{{ variables }}`. |
| **Images** | Paste an image URL (`https://example.com/image.png`) or click **Upload** to add one from your device. | Optional. Attached to that message. |
| **Documents** | Paste a document URL (`https://example.com/document.pdf`) or upload a file. | Optional. Attached to that message. |

## Add variables and structured input and output

### Variables

A variable is a value the caller (or the platform) fills in each time the agent runs. Write it as `{{ name }}` in the system prompt or a prompt message.

* **Quick way:** type `{{` in the prompt and pick a name from the list, or choose **Create new** to register one on the spot.
* **From the toolbar:** **Insert variable** → **Add variable**.
* **Built-in variables:** type `{{ bud.` to list the platform's own values. They are filled in automatically on every run and the caller cannot override them.

| Built-in variable | Value |
| - | - |
| `bud.user_country`, `bud.region`, `bud.city`, `bud.continent`, `bud.timezone` | Resolved from the caller's IP address by the gateway. |
| `bud.local_time` | The caller's local time at the start of the run. |
| `bud.client_type` | The caller's User-Agent string. The caller controls it, so do not use it as a security signal. |
| `bud.channel`, `bud.user_type` | The channel the run arrived on; whether the caller is an end user, another agent or a trigger. |
| `bud.trigger_origin`, `bud.connection_id` | For trigger-started runs: where the event came from, and which trigger connection sent it. |
| `bud.provider`, `bud.principal`, `bud.project_id` | The caller's identity provider, who or what invoked the run, and the project. |
| `bud.recursion_depth` | How deep the current agent-to-agent call chain is. |
| `bud.tokens_so_far`, `bud.cost_so_far` | Tokens used, and cost in US dollars, so far in this run. Cost reads 0 before the first model call. |

The same names drive the **Only when** conditions in governance rules ([Governing and supervising agents](https://docs.budecosystem.com/prompts-agents/governance.md)).

### Variable fields (Input card, **Structured input** on)

| Field | What to enter | Rules and defaults |
| - | - | - |
| **Variable name** | A short name with no spaces, for example `customer_tier`. | Required. Must be unique. Names that start with `bud`, `ctx`, `headers` or `meta` are reserved and refused ("Reserved name" or "Duplicate variable name" shows on the row). |
| **Describe this variable** | What the value means. | Optional. Passed to the model as the field's description. |
| **Type** | String, Number, Boolean, Array or Object. | A variable you only typed in the prompt, without defining it, shows as detected until you add it to the input schema. |
| **Default value** | Used when the caller sends none. | Optional. |
| **Validation** | Tick the box and enter a pattern, for example a regular expression. | Optional. Saved as the field's pattern. |

### Structured input

On the **Input** card, turn on **Structured input** and define the fields above. Callers then send those fields in `prompt.variables`. **Document required** and **Image required** make an attachment mandatory. The expanded editor previews the JSON schema these fields produce.

### Structured output

On the **Output** card, turn on **Structured output** and define the fields in the same way (name, description, type, default, validation). The agent's answer is then JSON that matches the schema. Streamed answers are checked against it as they arrive.

> [!TIP]
>
> Turn structured output on only when something downstream reads the answer by field name. A free-text answer is easier for people to read.

## Test while you build

1. Click the play icon (**Run Agent**) in the builder's left rail. A chat opens with the agent, with its tool calls shown live as they happen.
2. Change the prompt or settings, save, and chat again. **Back to Agent Settings** returns to the editor.
3. Click **New chat window** to open a second agent box, up to three. Give each a different model, prompt or setting and send the same message to compare.

Test chats are real runs: the agent calls its attached tools for real, so use a test project or read-only tools while you build.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.