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

# Objects: Records Inside Your Layest Data Collections

> Understand and manage objects (records) inside your Layest data collections. Create, edit, search, and delete objects from the UI or via agent actions.

An object is a single record within a data collection — the individual unit of structured information that your agents read, create, and update. If a collection is analogous to a table, an object is a single row in that table. Every object belongs to exactly one collection and conforms to that collection's attribute schema. Objects can be created manually through the Layest UI, generated automatically by agents at runtime, or imported in bulk from a CSV or JSON file.

## What Is an Object?

Each object stores values for the attributes defined in its parent collection. For example, in a `Customer Leads` collection with attributes for `Name`, `Email`, `Status`, and `Created At`, a single object might look like:

| Attribute  | Value                                         |
| ---------- | --------------------------------------------- |
| Name       | Priya Sharma                                  |
| Email      | [priya@example.com](mailto:priya@example.com) |
| Status     | Qualified                                     |
| Created At | 2024-11-03T14:22:00Z                          |

Every object is assigned a unique, immutable **Object ID** when it is created. Agents and integrations use this ID to reference specific records reliably, even if the object's field values change.

## Creating and Managing Objects

<Tabs>
  <Tab title="Manual Creation">
    You can create objects one at a time directly in the Layest UI — useful when you want to seed a collection with a few initial records or add a record outside of an automated workflow.

    **To create an object manually:**

    <Steps>
      <Step title="Open the collection">
        In the sidebar, navigate to **Data → Collections** and click the collection you want to add a record to.
      </Step>

      <Step title="Click New Object">
        Click the **New Object** button in the top-right corner of the collection view. A form panel opens on the right side of the screen.
      </Step>

      <Step title="Fill in the attribute fields">
        Enter values for each attribute. Required attributes are marked with an asterisk. Optional attributes can be left blank.
      </Step>

      <Step title="Save the object">
        Click **Save**. The object appears immediately in the collection list and is available to any agent with read access to the collection.
      </Step>
    </Steps>

    **Editing an object:**

    Click any object row to open its detail panel. Edit the field values you want to change and click **Save**. Changes take effect immediately.

    **Deleting an object:**

    Open the object's detail panel, click the **⋯ More** menu in the top-right corner of the panel, and select **Delete Object**. Confirm the deletion in the prompt. Deletion is permanent and cannot be undone from the UI.
  </Tab>

  <Tab title="Bulk Import">
    Bulk import lets you load many objects at once from a CSV or JSON file. This is the fastest way to populate a collection from an existing data source such as a spreadsheet, CRM export, or data file.

    **Supported formats:**

    * **CSV** — the first row must be a header row with column names that match your collection's attribute names exactly (case-insensitive).
    * **JSON** — a top-level array of objects where each object's keys map to attribute names.

    **To bulk import objects:**

    <Steps>
      <Step title="Open the collection">
        Navigate to **Data → Collections** and open the target collection.
      </Step>

      <Step title="Open the import dialog">
        Click the **⋯ More** menu next to **New Object** and select **Import Objects**.
      </Step>

      <Step title="Upload your file">
        Drag and drop your CSV or JSON file into the upload area, or click **Browse** to select it from your filesystem.
      </Step>

      <Step title="Map columns to attributes">
        Layest automatically maps file columns or JSON keys to collection attributes by name. Review and adjust any mappings that did not match automatically.
      </Step>

      <Step title="Preview and confirm">
        Review the import preview showing the first few rows. Resolve any validation warnings, then click **Import**. A progress indicator shows how many objects have been created.
      </Step>
    </Steps>

    **CSV example:**

    ```csv theme={null}
    Name,Email,Status,Created At
    Priya Sharma,priya@example.com,Qualified,2024-11-03T14:22:00Z
    Marco Rossi,marco@example.com,New,2024-11-04T09:10:00Z
    ```

    **JSON example:**

    ```json theme={null}
    [
      {
        "name": "Priya Sharma",
        "email": "priya@example.com",
        "status": "Qualified",
        "created_at": "2024-11-03T14:22:00Z"
      },
      {
        "name": "Marco Rossi",
        "email": "marco@example.com",
        "status": "New",
        "created_at": "2024-11-04T09:10:00Z"
      }
    ]
    ```
  </Tab>
</Tabs>

## Object IDs and Agent References

When Layest creates an object — whether manually, via import, or by an agent action — it assigns a unique **Object ID** in the format `obj_xxxxxxxxxx`. This ID never changes, even if you edit every field on the object.

Agents use Object IDs to target specific records in update and delete operations. For example, an agent that resolves a support ticket calls the update action with the ticket's Object ID to flip the status attribute to `resolved`. You can see an object's ID in its detail panel under the **Metadata** section.

When building agent instructions, you can direct the agent to store an Object ID in a variable and reuse it across multiple steps in the same workflow:

```text theme={null}
1. Query the Orders collection for orders where status = "pending".
2. Store the Object ID of each result.
3. For each Object ID, update the status attribute to "processing".
```

## Searching and Filtering Objects

The collection view provides several ways to find the objects you need:

* **Search bar** — performs a full-text search across all text attributes. Results update as you type.
* **Filters** — click **Add Filter**, choose an attribute, and set a condition (equals, contains, greater than, etc.). Stack multiple filters and switch between AND / OR logic.
* **Sort** — click any column header to sort. Click again to reverse the sort order.
* **Saved views** — save a combination of filters and sorts as a named view for quick access.

## Object History and Audit Trail

Every change to an object is recorded in its **History** tab. Open any object's detail panel and click **History** to see a timestamped log of every create, update, and delete event, along with:

* The attribute that changed
* The previous value and the new value
* Who or what made the change (a user name or an agent name)
* The exact timestamp in UTC

The audit trail is read-only. You cannot edit or delete history entries. Use the history log to debug unexpected agent behavior, satisfy compliance requirements, or understand how a record evolved over time.
