# Build an agent

> Creates an agent with its prompt, model and resources, hands work between agents, and chooses where people can reach it.

**Skill for your coding agent:** [`mindset-server-api/SKILL.md`](https://docs.mindset.ai/skills/mindset-server-api/SKILL.md)

**Skill for your coding agent:** [`mindset-build-agent/SKILL.md`](https://docs.mindset.ai/skills/mindset-build-agent/SKILL.md)

Building an agent goes in order: build the agent, connect your systems, add functions, scripts and widgets, test it, take it live, then put it in your product. Highlighted: Build.

## Ask your coding agent

```
Create the invoice exceptions agent for the finance team. Give it the supplier contracts knowledge base and the invoice comparison function, make its first version active, and keep it unavailable until I've tried it.
```

Skill: [mindset-build-agent](https://docs.mindset.ai/skills/mindset-build-agent/SKILL.md)

## What gets built

An [agent](https://docs.mindset.ai/docs/agents): a prompt, a model, and the resources it may use. Resources are operations on [connections](https://docs.mindset.ai/docs/connections-and-operations), [functions](https://docs.mindset.ai/docs/functions), [widgets](https://docs.mindset.ai/docs/widgets) and other agents. Each change is saved as a [version](https://docs.mindset.ai/docs/versions-and-going-live), and a new agent starts unavailable, so only org admins can reach it.

| Prompt field          | What goes in it                                                                             |
| --------------------- | ------------------------------------------------------------------------------------------- |
| **Purpose**           | What the agent is for, in a sentence or two                                                 |
| **Personality**       | Its identity and behavior. The main free text of the prompt                                 |
| **Background**        | Domain and audience context                                                                 |
| **Policy rules**      | Rules it must follow. These are instructions to the model, and Mindset doesn't enforce them |
| **Output formatting** | How replies are shaped                                                                      |

Each field holds at most 2,000 characters, and a longer one is refused, not trimmed. Mindset adds the reply language on every run, and the page's situational awareness when there is any.

> **Info:** Compliance doesn't go in the prompt. Personal data protection, write approval and the audit record come from your org's settings and apply to this agent as to every other. See [Compliance](https://docs.mindset.ai/docs/compliance).

## What you decide

- **What stays in the prompt.** Most of it. A rule that must hold every time belongs in a [script](https://docs.mindset.ai/docs/write-a-script) condition or a [function](https://docs.mindset.ai/docs/build-a-function), or the operation stays off the agent.
- **The model and reply language.** Only models your org has a provider key for are offered. The reply language is **Inherit**, which follows the org, or one you name, such as "Spanish".
- **The smallest set of resources.** Anyone who can reach the agent can use everything it holds.
- **Activate or stage.** On an agent people already use, your coding agent stages each change as a version, and you activate it on **Versions & Availability**.
- **Where it can be reached.** The Hub, your own product, other agents, schedules, triggers or outside systems. Your coding agent never opens **The Hub**, **Embedded in your own product** or **Outside systems** on its own. [How agents are started and reached](https://docs.mindset.ai/docs/how-agents-are-started-and-reached) explains each place.

> **Warning:** Ticking **The Hub** shares the agent with everyone in your org, in that environment. There's no per-person list, so keep a write that shouldn't be everyone's off an agent in the Hub.

## Hand work to another agent

A lead agent can hand a task to a helper agent and use its answer:

```
Add the supplier contracts agent as a helper on the invoice exceptions agent, and let other agents hand it tasks.
```

Skill: [mindset-build-agent](https://docs.mindset.ai/skills/mindset-build-agent/SKILL.md)

The helper goes on the lead's **Agents (A2A)** resources, in a new version, and needs **Other agents** ticked on its own availability. The lead calls it as a tool named `delegate_to__` and the helper's handle, for example `delegate_to__supplier-contracts`. The helper runs as itself, with its own resources and permissions, never the lead's. A chain can be several agents deep, but a hand-off to an agent already on the chain is refused, and the whole chain shares a budget of 8 hand-offs per run.

## Done when

- You talked to it on the **Chat** tab, or your coding agent called it, and it used the resources you gave it.
- One version is active, and you know which.
- It shows **Available** in the places you chose, and you can say in one sentence what it lets everyone there do. An **Unavailable** badge names what's missing.

## In your repo

The prompt fields are files in the agent's `prompt/` folder, and its model, resources and availability are in `agent.json`. Your coding agent applies a change and stages it as a version. See [Keep your agents in your code](https://docs.mindset.ai/docs/keep-your-agents-in-your-code).

## In the Studio

**Agents → + New agent** opens the **Agent Builder** in a dialog. Describe the agent, then press **Open agent →**. Edit the prompt on **System Prompt**, the model and reply language on **Settings**, and what it uses on **Resources**. Press **Save as version**, try it on **Chat**, then activate it and choose where it's reached on **Versions & Availability**.

![The System Prompt tab of the Invoice exceptions agent, with the Agent Builder on the left.](https://docs.mindset.ai/images/docs/studio/agent-system-prompt.png)
