> For the complete documentation index, see [llms.txt](https://docs.riff.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.riff.ai/get-started/quickstart-agent-v2.md).

# Build your first agent

How to build an agent in Riff: choose Assistant or Autonomous agent, create it from New agent, brief it in the build chat, connect your systems, test and deploy.

You build an agent by chatting with it. No code is needed. This page takes you from an idea to a deployed agent. Once it is running, [Working with your autonomous agent](https://docs.riff.ai/guides/working-with-your-autonomous-agent.md) covers daily review and fixes.

## Assistant or Autonomous agent

You choose one when you create the agent, and you can't change it later.

|                         | Assistant                                 | Autonomous agent                                                  |
| ----------------------- | ----------------------------------------- | ----------------------------------------------------------------- |
| How work reaches it     | Someone asks it in a chat                 | Work arrives on a schedule or by email. Each item becomes a task. |
| Good for                | Answering questions, drafting, looking up | Repeatable work with clear rules: routing, chasing, checking      |
| Tabs while you build it | **Chat**, **Agent**, **Activity**         | **Chat**, **Pipeline**, **Agent**, **Triggers**, **Activity**     |

This page follows an autonomous agent. An Assistant is built the same way, with no tasks or triggers to set up.

{% hint style="info" %}
Building a screen people open, such as a dashboard or an approval portal? That's an app, not an agent. See [What you can build with Riff](https://docs.riff.ai/get-started/what-you-can-build-with-riff-v2.md).
{% endhint %}

## Words to know

| Word           | Meaning                                                                                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Task**       | One piece of work: one invoice, one order, one request.                                                                                     |
| **Build mode** | Where you change the agent. Nothing you do there affects your team until you deploy.                                                        |
| **Live**       | The deployed agent your team uses.                                                                                                          |
| **Deploy**     | Makes your build mode changes live.                                                                                                         |
| **Rule**       | A decision the agent makes the same way every time, such as "invoices over 10,000 go to the finance lead".                                  |
| **Tool**       | One action the agent can take, such as sending an email. Each tool has a permission that says whether it acts on its own or asks you first. |
| **Trigger**    | What brings in new work, usually a schedule such as "every weekday at 07:00".                                                               |

## 1. Prepare

Write these down before you build. You will paste from them.

* **The job in one sentence.** "Chase overdue supplier invoices and tell finance when a person needs to act."
* **What one task is.** One invoice, one order, one request.
* **The systems.** Where work comes from and where results go. They must already be connected to your workspace (see step 4).
* **Your rules.** Every decision the agent makes and the rule behind it, in your own words.
* **What needs approval.** For each action: the agent does it on its own, asks you first, or never does it.
* **Five to ten test cases**, each with the result you expect. Include at least two awkward ones.
* **A reviewer.** The person who checks the agent's work for the first week after a change.

## 2. Create the agent

1. Click **New agent** at the bottom of the left sidebar. If you can't see it, ask your workspace admin for access.
2. **Agent name**: what your team will call it, such as "Supplier chaser".
3. **What's the goal?**: paste your one-sentence job.
4. **What kind of agent is this?**: pick **Autonomous agent** if work should arrive by itself, or **Assistant** if people will ask it things in a chat. **Assistant** is selected by default.
5. Click **Create agent**. The agent opens in build mode and greets you on the **Chat** tab.

<div data-with-frame="true"><figure><img src="https://4203676568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmj3x7kCuQ8vAs0u0uIPo%2Fuploads%2FFqeC3Y6DuxPTRGb9e4sk%2Fnew-agent-form.png?alt=media&amp;token=54643cdf-5666-45ff-a18c-dc5ca0aa250f" alt="The Define your agent form filled in for a Supplier chaser: Agent name, What&#x27;s the goal, and What kind of agent is this with Autonomous agent selected"><figcaption></figcaption></figure></div>

Reply to the greeting with a full brief. Copy this and fill in the brackets:

> One task is one \[invoice / order / request]. New work comes from \[system and place]. Results go to \[system and place]. The rules are: \[your rules]. You may do these on your own: \[actions]. Always ask me before: \[actions]. Never: \[actions]. Before you build anything, list what you will set up and wait for my go-ahead.

<div data-with-frame="true"><figure><img src="https://4203676568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmj3x7kCuQ8vAs0u0uIPo%2Fuploads%2F2IGPqGBpg09ahRsKy21X%2Fbuild-chat.png?alt=media&amp;token=e15088f8-898a-44e7-b825-e1c15f292eec" alt="The Chat tab in build mode: the new agent greets you, and your reply is the brief"><figcaption></figcaption></figure></div>

## 3. Find your way around

**To open an agent later:** click **Agents** in the left sidebar and pick it. You land on the live agent, the version your team uses. Click **Edit agent**, top right, to open build mode.

Build mode has these tabs along the top:

| Tab          | What it is for                                                                          |
| ------------ | --------------------------------------------------------------------------------------- |
| **Chat**     | The build chat. Tell the agent what to change here. Start a new chat for each change.   |
| **Pipeline** | Test tasks for build mode, kept separate from live tasks. Autonomous agents only.       |
| **Agent**    | Everything the agent is made of. You can edit rules and tool permissions here directly. |
| **Triggers** | What brings in work, how often, and anything that is failing. Autonomous agents only.   |
| **Activity** | Every run, with the tools it called and how long it took.                               |

Next to the agent's name, an orange **Changes to deploy** label means build mode has changes that aren't live yet. **Draft** means the agent has never been deployed. **Deploy** and **View live** are at the top right.

<div data-with-frame="true"><figure><img src="https://4203676568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmj3x7kCuQ8vAs0u0uIPo%2Fuploads%2FJL5VkpS8VxsYAyTY2iUF%2Fagent-tab.png?alt=media&amp;token=bc4db2d7-3487-401e-a14a-488470fa1d9e" alt="The Agent tab in build mode: the tabs Chat, Pipeline, Agent, Triggers and Activity, Deploy and View live at the top right, and the Build / Live switch"><figcaption></figcaption></figure></div>

### What an agent is made of

An agent has five parts, all on the **Agent** tab. Every change you ask for ends up in one of them.

| Part             | What it is                                                     | Example                                                |
| ---------------- | -------------------------------------------------------------- | ------------------------------------------------------ |
| **Instructions** | Its job description                                            | "Chase each overdue supplier invoice until it is paid" |
| **Rules**        | Decisions it makes the same way every time, each with a reason | "Invoices over 10,000 go to the finance lead"          |
| **Skills**       | Step-by-step procedures it follows                             | Check the status, draft the reminder, log it           |
| **Knowledge**    | Reference information it looks things up in                    | Supplier contacts and payment terms                    |
| **Tools**        | Actions it can take, each set to act on its own or ask first   | Send a reminder: asks you first                        |

Ask for changes to any part in the build chat. Rules and tool permissions can also be edited directly: see [Rules](https://docs.riff.ai/reference/agent-builder/rules.md) and [Tool permissions and approvals](https://docs.riff.ai/reference/agent-builder/tool-permissions-and-approvals.md).

An agent's **Knowledge** belongs to that agent. Your team's [Context](https://docs.riff.ai/reference/team-workspace/context.md) library is separate and shared across the workspace.

Two habits prevent most rework:

* **Put decisions in rules.** When a decision is wrong, ask for a rule change, not a change to the instructions.
* **Set approval on the tool.** Writing "check with me first" in the instructions doesn't guarantee it. Setting the tool to **Asks you first** does.

## 4. Tell it which systems to use

The agent works with the systems already connected to your workspace. You don't set up connections in the agent.

1. Ask what it can use: "Which systems can you use right now? Which would you need for this job that you do not have?"
2. Tell it which systems to use, and for what: where work comes from and where results go.
3. Say exactly where to read and write. "Use the accounting system" is too vague. Name the mailbox, table, folder or channel, the fields that matter, and what it must not touch.
4. Say when to look for work, for example "every weekday at 07:00". The agent sets up a schedule, which you see on the **Triggers** tab.

If a system you need isn't connected, or the agent says a connection needs approval, talk to your Riff contact and your IT team. Team admins add connections: see [Integrations](https://docs.riff.ai/reference/shared/integrations.md).

{% hint style="warning" %}
Never paste a password or key into the chat.
{% endhint %}

Start read-only. Let the agent write once its reads are correct, and keep every tool that writes on **Asks you first** until you trust it.

## 5. Test

Give the agent your test cases in the build chat and ask what it would do with each:

> For each of these, tell me what you would do, whether you would ask me, and which rule decided it.

A wrong answer means a rule is missing or unclear. Correct that one case, then test again. Make one change at a time: two changes tested together make it hard to tell which one caused a problem.

## 6. Deploy

Click **Deploy**, top right in build mode, check what is listed, then click **Deploy** in the panel. Tool permissions are not copied by Deploy. See [Deploy an agent](https://docs.riff.ai/reference/agent-builder/deploy-an-agent.md) for the checks to run before and after.

## Next

* [Working with your autonomous agent](https://docs.riff.ai/guides/working-with-your-autonomous-agent.md): review its work, fix mistakes and change how it works.
* [Prompts to copy](https://docs.riff.ai/reference/agent-builder/prompts-to-copy.md): ready-made build chat prompts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.riff.ai/get-started/quickstart-agent-v2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
