> For the complete documentation index, see [llms.txt](https://docs.nrnagents.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nrnagents.ai/overview/installation-and-setup.md).

# Installation & Setup

## Installation

Methods for installing the package differs for each game engine. For games building browser games (using Javascript), you can install the package as follows:

```bash
npm install nrn-agents
```

For studios that use Unity or Unreal engine, please directly message an NRN team member to get access to the package.&#x20;

## Setup

In order to start using the SDK, you will need to set your `apiKey` and `gameId` as static attributes on the `AgentFactory` class (in Javascript) or `ModelWrapper` class (in C#). Each `apiKey` only works for a specific `gameId`.

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

```javascript
const { AgentFactory } = require('nrn-agents');

AgentFactory.setApiKey("my-api-key");
AgentFactory.setGameId("my-game-id");
```

{% endtab %}

{% tab title="C# - Unity" %}

```csharp
using ArcAgents.MachineLearning;

ModelWrapper.SetApiKey("my-api-key");
ModelWrapper.SetGameId("your-game-id");
```

{% endtab %}
{% endtabs %}

Now that you have your `apiKey` and `gameId` set, every HTTP request you make to the NRN Agents server will automatically use it.

## Additional Files

In order for the NRN Agents SDK to know how to communicate with a game, we need to add 2 files. These files will define the [state space](/getting-started/state-space.md) and [action space](/getting-started/action-space.md), which we begin to discuss in the [basic integration](/getting-started/basic-integration.md) section.

### Javascript Structure

It is advised that game studios make an `nrn-integration` folder inside their `helpers` folder. Inside this folder, we need to add the files to define the state and action space.

```
.
└── src/
    └── helpers/
        └── nrn-integration/
            ├── nrn-state-space.js
            └── nrn-action-space.js
```

### Unity Structure

It is advised that game studios make an `NrnIntegration` folder inside the`Script` folder. Inside this folder, we need to add the files to define the state and action space.

```
.
└── Assets/
    └── Scripts/
        └── NrnIntegration/
            ├── NrnStateSpace.cs
            └── NrnActionSpace.cs
```

### Unreal Structure

It is advised that game studios make an `NrnIntegration` folder inside the folder where they have all their game code. Inside this folder, we need to add the files to define the state and action space.

```
.
└── Source/
    └── Game/
        └── NrnIntegration/
            ├── NrnStateSpace.cpp
            ├── NrnStateSpace.h
            ├── NrnActionSpace.cpp
            └── NrnActionSpace.h
```


---

# 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 dynamically by asking a question.

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

```
GET https://docs.nrnagents.ai/overview/installation-and-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
