# Build Agent

\
In this guide we will:

1. [Clone](https://github.com/BitteProtocol/agent-next-boilerplate/) the agent template
2. [Generate](https://key.bitte.ai/) and set API Key
3. Develop the agent with make-agent
4. Deploy your agent and go live!

{% embed url="<https://share.descript.com/view/ExGTpHKkpHo>" %}

## 1. Clone agent template

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Bitte Next Agent Template</td><td></td><td></td><td><a href="https://74933262-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB52AZELB8jl58pzYsH6O%2Fuploads%2FfJVnkmFduryP3wW3LvM4%2FZAxWAoD.webp?alt=media&#x26;token=d1241cd9-76dd-4ed3-bb62-fbd7afd63394">ZAxWAoD.webp</a></td><td><a href="https://github.com/BitteProtocol/agent-next-boilerplate/tree/main">https://github.com/BitteProtocol/agent-next-boilerplate/tree/main</a></td></tr></tbody></table>

```
git clone https://github.com/BitteProtocol/agent-next-boilerplate.git
```

## 2. Get API Key and Set Environment Variables

* #### Get your api key at <https://key.bitte.ai>
* Change filename ***.env.example*** to ***.env*** and add your api key

```
BITTE_API_KEY="bitte_#####"
```

## 3. Start Coding

Install dependencies&#x20;

```
cd agent-next-boilerplate && pnpm i
```

Run boilerplate, this will automatically run the make-agent library + your agent server

```
pnpm dev
```

\
When you run your project, the UI launches in your console, allowing you to access the chat sandbox with local dev environment connections for EVM and NEAR wallets. By testing the boilerplate with a command like "Hey, can you do a coinflip for me", you'll trigger the coinflip tool, which generates a random value.

<figure><img src="https://74933262-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB52AZELB8jl58pzYsH6O%2Fuploads%2FVFzOmNYy8QfH82OTmJLN%2FScreenshot%202025-02-05%20at%2012.20.49.png?alt=media&#x26;token=4c44b30f-93d6-4cc8-a00e-e397f186533c" alt=""><figcaption></figcaption></figure>

You can customize tools by modifying their route's return value and updating the `ai-plugin` route manifest to define and provide LLM instructions for tool usage.\
\
You can learn more about your manifest here: [manifest](https://docs.bitte.ai/agents/manifest "mention")

To send transactions, return the transaction body in your route. In the manifest, specify that the route returns a valid transaction. The runtime will automatically detect this if you have the appropriate tools (generate-evm-tx or generate-transaction) defined, which are already set up in the boilerplate and prepare the transaction in the UI.\
\
**Check the create-near-transaction and create-evm-transaction routes for examples**

## 4. Go live!

Consider pushing your code to its own GitHub repository and hosting it in a easy to deploy service like [Vercel](https://vercel.com/new). There are other alternatives, but we find Vercel very easy to work with.

Note that your deploy script includes `make-agent deploy`. This command will validate your API key, look into the deployment URL (for most common hosting providers) and automatically communicate any changes made to our registry.

In case you want to have more control over your deployment URL, you can set `BITTE_AGENT_URL`

```properties
BITTE_AGENT_URL=<YOUR_DESIRED_URL>
```

***

## From your own repo

### Install make-agent

[make-agent](https://docs.bitte.ai/agents/make-agent) is a CLI tool that was built to make the development of an Open Agent as easy as possible-

The templates should have these packages installed. But if you're trying to add this to an existing project, please install `make-agent` and `concurrently`.

{% tabs %}
{% tab title="npm" %}

```bash
npm i -D make-agent concurrently
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm i -D make-agent concurrently
```

{% endtab %}

{% tab title="bun" %}

```bash
bun add -D make-agent concurrently
```

{% endtab %}
{% endtabs %}

Your `package.json` should look like this:

```
  "scripts": {
    "dev": "concurrently \"next dev\" \"make-agent dev --port 3000\"",
    "build": "next build && make-agent deploy",
    "start": "next start",
    "lint": "next lint"
  },
```

You can now run in development mode.

{% tabs %}
{% tab title="npm" %}

```bash
npm run dev
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm run dev
```

{% endtab %}

{% tab title="bun" %}

```bash
bun run dev
```

{% endtab %}
{% endtabs %}

```
```

Learn more about the Manifest file by following the link below.

{% content-ref url="manifest" %}
[manifest](https://docs.bitte.ai/agents/manifest)
{% endcontent-ref %}

###
