# Inference

In order to actually use the model in game, we need to perform inference. This means that we give the model a state matrix, and have it output an action.

For most use cases, it is appropriate to use the "select action" method. This will create a mapping which can then be used, via the action space conversion mention in [this section](/getting-started/action-space.md), to execute the action in-game.&#x20;

Alternatively, we allow game studios to access the "raw output", which is the probabilities of taking each of the actions in that state. The NRN Agents SDK comes with a **Probabilistic Agent Wrapper** that handles the distribution, but if game studios want more flexibility in building a custom wrapper, they are able to do this as well.

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

```javascript
// Sample from the distribution to select an action
const action = agent.selectAction(state);

// Get the probability distribution over actions
const probabilities = agent.getProbabilities(state);
```

{% endtab %}

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

```csharp
// Sample from the distribution to select an action
Dictionary<string, bool> action = Agent.SelectAction(state);

// Sample from the distribution to select an action
Dictionary<string, Matrix> probabilities = Agent.GetProbabilities(state);
```

{% endtab %}
{% endtabs %}


---

# 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://docs.nrnagents.ai/getting-started/inference.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.
