# Quickstart

### 1. Configure your project

Set up a new project and install the required dependencies:

```bash
mkdir axar-demo
cd axar-demo
npm init -y
npm i @axarai/axar ts-node typescript
npx tsc --init
```

{% hint style="warning" %}
You need to configure your `tsconfig.json` file as follows for better compatibility:

```json
{
  "compilerOptions": {
    "strict": true,
    "module": "CommonJS",
    "target": "es2020",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
  }
}
```

{% endhint %}

### 2. Write your first agent

Create a new file `text-agent.ts` and add the following code:

```ts
import { model, systemPrompt, Agent } from "@axarai/axar";

@model("openai:gpt-4o-mini")
@systemPrompt("Be concise, reply with one sentence")
class TextAgent extends Agent<string, string> {}

(async () => {
  const response = await new TextAgent().run("Who invented the internet?");
  console.log(response);
})();
```

### 3. Run the agent

Add your OpenAI API key and run your code.

```bash
export OPENAI_API_KEY="sk-proj-YOUR-API-KEY"
npx ts-node text-agent.ts
```

{% hint style="danger" %}
It's required to use `ts-node` with AXAR at this time. `tsx` does not support experimental decorator features fully as of yet.&#x20;
{% endhint %}

It should print something like this:

```
The internet was developed through the collaborative efforts of many individuals, but key figures include Vint Cerf and Bob Kahn, who created the TCP/IP protocols
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://axar-ai.gitbook.io/axar/getting-started/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
