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

# Add To Context

<Frame>
  <img class="image-center" src="https://mintcdn.com/cognigy-15abf2ba/jD73u_IBHRit9B59/_assets/ai/develop/node-reference/logic/add-to-context.png?fit=max&auto=format&n=jD73u_IBHRit9B59&q=85&s=02402bade13df49554523ab222966b2e" alt="Add To Context Node configuration panel" style={{ width: 'auto' }} width="464" height="120" data-path="_assets/ai/develop/node-reference/logic/add-to-context.png" />
</Frame>

## Description

This Node stores information in the [Context](/ai/agents/develop/ai-agent-memory/context) object. With this approach, you can use the stored value throughout the session on subsequent user inputs.

## Parameters

| Parameter | Type          | Description                                                                                                                                                                                                                                                                                                                             |
| --------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Key       | CognigyScript | The key where to store in the Context object. For example, if you enter `requestedProduct`, the value is assigned to the `context.requestedProduct` key. You can use nested keys, for example, entering `user.profile.name` assigns the value to the `context.user.profile.name` key. This parameter doesn't support dashes or hyphens. |
| Value     | CognigyScript | The value to store in the Context object.                                                                                                                                                                                                                                                                                               |
| Mode      | Select        | <ul><li>**Simple** — assigns the value to the key.</li><li>**Array** — appends the value to an array under the key. By default, you can add only unique values. If you need to add a value that already exists in the array, use the `.push()` function in a [Code Node](/ai/agents/develop/node-reference/basic/code).</li></ul>       |

<Accordion title="Storing an Object">
  If you want to store an object in the Context object, use `.preserveType()` at the end of the CognigyScript expression to keep it as an object. For example, `input.slots.city[0].preserveType()` stores the Slot object for the first found city entity in the Context object.
</Accordion>
