Prerequisites

1

Create an Ardent account

If you haven’t already done so, create an Ardent account.
2

Choose a model

Agents are built on top of AI models, like Anthropic’s Claude or OpenAI’s GPT. In order to build an Ardent agent, you’ll need to sign up for an account with Anthropic, OpenAI, or Google Gemini, and get an API key.For this walkthrough, we’ll use Anthropic models. If you’d rather use OpenAI or Gemini, you can replace any reference to anthropic with openai or gemini.
3

Add your API key as a secret

This page is not yet complete.
4

Install the Ardent CLI

First, you need to install the Ardent CLI (command-line interface). You can use the Ardent CLI to set up new projects, develop your agents, and deploy them to the Ardent platform.To download and install the Ardent CLI, run the following command:
npm i -g ardent
After the Ardent CLI is installed, you’ll be able to run the ardent command from anywhere on your machine.

Build your first agent

1

Create a new project

Now that the Ardent CLI is installed, run the following command to create a new agent project:
ardent init
The CLI will ask you to log in to Ardent, and will ask you to provide a name and a folder on your machine where you want to create your project. Once complete, your project will contain a few files:
src/
  index.ts
node_modules/
  ...
ardent.jsonc
package.json
  • The src/index.ts file contains the code that will power your agent.
  • The node_modules folder contains libraries that are used by your agent, including the Ardent SDK.
  • The ardent.jsonc file contains configuration for your agent.
  • The package.json file is used to track libraries and version information for your agent.
We recommend using TypeScript, but it isn’t required. If you’d prefer to use vanilla JavaScript instead, you can rename src/index.ts to src/index.js.
2

Edit your agent

Open your project in your favorite editor, like Cursor or Visual Studio Code. Open the src/index.ts file and you should see something like this:
index.ts
import { Agent, anthropic } from '@ardent-ai/sdk';

const agent = new Agent({
  model: anthropic(),
  instructions: 'You are a helpful assistant.'
});

export default agent;
Right now, your project only has a single source file, index.ts. You can structure your code however you prefer, but every project has to export an instance of the Agent class from its main entrypoint.By default, the Ardent CLI will expect the entrypoint to be src/index.ts or src/index.js, but you can change this by setting the main field in your project’s package.json file.
3

Start a dev session

To begin developing your agent, you’ll want to start a dev session. During a dev session, the Ardent CLI will watch your local files for changes. Every time you save a file, the CLI will rebuild and deploy your changes to the Ardent platform.To start a dev session, run the following command in your project’s root (the same folder that contains your ardent.jsonc file.)
ardent dev
Once the dev session starts, open the Ardent app and navigate to the Agents screen. You should see your new agent listed!
4

Add a tool

Right now, your agent doesn’t do much beyond the base model that you’ve chosen to use. Let’s teach the agent a new skill!We’re going to create a tool that your agent can call. The tool will request an article from Wikipedia, and then ask the model to generate a summary of the article’s key points.Update index.ts with the changes highlighted below:
index.ts
import { Agent, Tool, anthropic } from '@ardent-ai/sdk';

const summarizeRandomArticle = new Tool({
  name: 'summarizeRandomArticle',
  description: 'Retrieve and summarize a random article from Wikipedia',
  async execute({ ai }) {
    const response = await fetch('https://en.wikipedia.org/wiki/Special:Random?action=raw');
    const text = await response.text();
    return ai.stream({
      prompt: `Read the following Wikipedia article and return a list of the most important topics discussed:\n\n${text}`
    });
  }
})

const agent = new Agent({
  model: anthropic(),
  instructions: "You are an excellent teacher. Whenever the user asks to learn something new, get a random article from Wikipedia and summarize it.",
  tools: [summarizeRandomArticle]
});

export default agent;
When you save the file, you should see the Ardent CLI say that it’s bundling and uploading your new agent code to the Ardent platform.
5

Create a task

Agents operate on tasks. In the Ardent app, click the Create task button at the top right of the screen to create a new task for your agent to perform.Then, ask the model something like this:
Teach me something!
If everything’s working, your agent will request an article from Wikipedia and show you a summary!
6

Deploy your agent

Since you have an active dev session, your agent will be visible to you, but only to you. In order to allow others in your workspace to use your agent, you need to deploy it. This creates a new version of your agent which users can select.To deploy your agent, run the following command:
ardent deploy
Unlike dev sessions, where your agent is constantly redeployed every time you make a change, deployments are immutable. That means that once a deployment is created, it can’t be changed. You can, however, create any number of deployments for your agent.

Next steps

Congratulations! You’ve created your first Ardent agent. You can continue to make changes to your project, and as long as your dev session is running, your changes will be published immediately. In this walkthrough, you learned:
  1. Agents are the fundamental building blocks of Ardent.
  2. Models provide agents with reasoning capabilities.
  3. Tools allow agents to call out to remote systems, load data, do calculations, and anything else you can dream up.