<commit_before>---
navtitle: Output
sort: 3
---

# Action output

The action output is the value returned by the [action handler](/current/action/handler) eventually modified and wrapped inside a [promise](/current/usages/promise).

Nikita modifies the handler return value [differently](/current/action/handler#return) depending on its type. In most cases when the handler returns an object, it is merged with the object containing the following properties:

- [`status`](/current/action/output/status)   
  A boolean value of the action status.
- [`log`](/current/action/output/log)   
  An array of objects with [logging](/current/usages/logging_debugging) information of the action execution.

The [`raw_output` metadata](/current/metadata/raw_output) is used to instruct Nikita to not alter the value returned by the handler.

## Accessing

The action output is returned when its [promise](/current/usages/promise) is fulfilled, thus, it is accessed using the [`async`/`await` operators](https://nodejs.dev/learn/modern-asynchronous-javascript-with-async-and-await).

```js
nikita
// highlight-next-line
.call(async function() {
  // Access the action output
  // highlight-next-line
  const output = await this.call(({tools: {log}}) => {
    return {who: 'Nikita'}
  })
  // Print the output
  console.info(output) // { who: 'Nikita', status: false, logs: [] }
})
```<commit_msg>docs: review output<commit_after>---
navtitle: Output
sort: 3
---

# Action output

The action output is the value returned by the [action handler](/current/action/handler) and available inside a [promise](/current/usages/promise).

## Usage

The action output is returned when its [promise](/current/usages/promise) is fulfilled, thus, it is accessed using the [`async`/`await` operators](https://nodejs.dev/learn/modern-asynchronous-javascript-with-async-and-await).

```js
nikita
// highlight-next-line
.call(async function() {
  // Access the action output
  // highlight-next-line
  const {who} = await this.call(({tools: {log}}) => {
    return {who: 'Nikita'}
  })
  // Print the output
  console.info(who)
  // Output the value "Nikita"
})
```

## Plugin enrichment

This returned value is eventualy modified by plugins.

The `@nikitajs/core/lib/plugins/status` plugin enriches the value with a `$status` property when an object literal is returned and converts the value `true` to `{ $status: true }` when a boolean value is returned. The `@nikitajs/core/lib/plugins/output_log` plugin returns the logs emitted inside the action.

Below is the description of those properties when the returned value is an object literal:

- [`$status`](/current/action/output/status)   
  A boolean value of the action status.
- [`$log`](/current/action/output/log)   
  An array of objects with [logging](/current/usages/logging_debugging) information of the action execution.

In case the returned value shall be preserved and untouched, the [`raw_output` metadata](/current/metadata/raw_output) instructs Nikita to not alter the value returned by the handler.
{'fraction_non_alphanumeric': 0.1194078947368421, 'fraction_numerical': 0.0006578947368421052, 'mean_word_length': 4.2979094076655056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1062512', 'n_tokens_mistral': 893, 'n_tokens_neox': 870, 'n_words': 317}