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

# Quick start

> Build and deploy your first Ardent agent.

## Prerequisites

<Steps>
  <Step title="Create an Ardent account">
    If you haven't already done so, create an Ardent account.
  </Step>

  <Step title="Choose a model">
    Agents are built on top of AI [models](/concepts/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](/reference/models/anthropic) with [openai](/reference/models/openai)
    or [gemini](/reference/models/gemini).
  </Step>

  <Step title="Add your API key as a secret">
    <Warning>This page is not yet complete.</Warning>
  </Step>

  <Step title="Install the Ardent CLI">
    First, you need to install the [Ardent CLI](/reference/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:

    <CodeGroup>
      ```bash npm theme={null}
      npm i -g ardent
      ```

      ```bash pnpm theme={null}
      pnpm i -g ardent
      ```

      ```bash yarn theme={null}
      yarn global add ardent
      ```
    </CodeGroup>

    After the Ardent CLI is installed, you'll be able to run the `ardent` command from anywhere on your machine.
  </Step>
</Steps>

## Build your first agent

<Steps>
  <Step title="Create a new project">
    Now that the Ardent CLI is installed, run the following command to create a new agent project:

    ```bash theme={null}
    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](/reference/sdk).
    * The `ardent.jsonc` file contains [configuration](/reference/configuration) for your agent.
    * The `package.json` file is used to track libraries and version information for your agent.

    <Tip>
      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`.
    </Tip>
  </Step>

  <Step title="Edit your agent">
    Open your project in your favorite editor, like [Cursor](https://cursor.com) or [Visual Studio Code](https://code.visualstudio.com/).
    Open the `src/index.ts` file and you should see something like this:

    ```ts index.ts theme={null}
    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](/reference/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](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#main)
    in your project's `package.json` file.
  </Step>

  <Step title="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.)

    ```bash theme={null}
    ardent dev
    ```

    Once the dev session starts, open the [Ardent app](https://app.ardent.ai) and navigate to the
    Agents screen. You should see your new agent listed!
  </Step>

  <Step title="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](/concepts/tools) 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:

    ```ts index.ts {2,3-13,17-18} theme={null}
    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.
  </Step>

  <Step title="Create a task">
    Agents operate on [tasks](/concepts/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!
  </Step>

  <Step title="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](/concepts/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:

    ```bash theme={null}
    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.
  </Step>
</Steps>

## 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](/concepts/agents) are the fundamental building blocks of Ardent.
2. [Models](/concepts/models) provide agents with reasoning capabilities.
3. [Tools](/concepts/tools) allow agents to call out to remote systems, load data, do calculations,
   and anything else you can dream up.
