# Add Items

### Overview

This procedure adds specified items to a department box *(a storage unit within an agent)*. Using this procedure, you can insert individual items or bulk data, including tables.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>x is a department box</code></summary>

#### What does it do?

Specifies a department box.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace **x** with the department box's name.

#### Example

```
HR is a department box
```

</details>

<details>

<summary><code>the department box's engine is x</code></summary>

#### What does it do?

Specifies the engine used for the department box. Options include: **Amazon S3** for large or unstructured data, **Amazon DynamoDB** for fast key-value lookups, and **Amazon OpenSearch** for advanced search and filtering capabilities.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x** with one of the following values: `s3`, `dynamodb`, `opensearch`. The default is `s3`.

#### Example

```
the department box's engine is "dynamodb"
```

</details>

<details>

<summary><code>add the item to the department box</code></summary>

#### What does it do?

Specifies an item to add to a department box.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace **the item** with an item (value or table object) to be added. Replace **the department box** with the name of a department box.

#### Example

```
add the message to HR
```

</details>

<details>

<summary><code>the key is x</code></summary>

#### What does it do?

Specifies the key under which the item(s) will be stored in the department box. If the item to be added to the department box is a table, "the key" represent the name of the column that holds the keys.

#### Where does it go?

Indented under `add the item to the department box`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x** with a text value or reference.

#### Example

```
the key is "announcement"
```

</details>

<details>

<summary><code>the value is x</code></summary>

#### What does it do?

Specifies the name of the column that holds the values, if the item to be added to the department box is a table. If this is *not* specified when adding a table, all columns except the key column will be stored as a dictionary value. This enables bulk upload of complex records where each row becomes a key-value pair with the value being a dictionary of all remaining column data. When the value is specified, traditional single-column mode is used.

#### Where does it go?

Indented under `add the item to the department box`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x** with a text value or reference. The default is `value`.

#### Example

```
the value is "user@kognitos.com"
```

</details>

<details>

<summary><code>the batch size is x</code></summary>

#### What does it do?

Specifies the number of items to process in each batch, improving I/O performance by reducing the number of database calls.

#### Where does it go?

Indented under `add the item to the department box`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x** with a **numeric** value or reference. The default is `1000`.

#### Example

```
the value is 50
```

</details>

### Examples

#### 1. Add a Singular Entry

```
create an entry as follows
    the entry's name is "arugula"
    the entry's amount is "100LB"
    the entry's origin is "USA-CA"
Greens is a department box
add the above entry to Greens
```

#### 2. Add Multiple Entries

```
create a spy as follows
    the spy's name is "tinker"
    the spy's country is "USA"
create a spy as follows
    the spy's name is "tenor"
    the spy's country is "UK"
create a spy as follows
    the spy's name is "doctor"
    the spy's country is "AU"
Top Secret is a department box
add the above spies to Top Secret
```

#### 3. Traditional Single-Column Approach

```
HR is a department box
the department box's engine is "s3"
the message is "team meeting at 10 AM"
add the message to HR with
    the key is "announcement"
```

#### 4. Traditional Table with Key-Value Columns

```
HR is a department box
the department box's engine is "s3"
add the table to HR with
    the key is NAME
    the value is EMAIL
```

#### 5. Multi-Column Table Upload

```
HR is a department box
the department box's engine is "s3"
add the table to HR with
    the key is employee_id
# This will store each row as: employee_id -> {name: "John", department: "Engineering", salary: 75000, ...}
```
