> ## 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.

# Data Collections: Organize, Query, and Manage AI Data

> Organize data in Layest collections — structured record stores your agents can query and update, with filtering, sorting, and access control per agent.

Data collections are structured stores of objects that your agents can read from and write to during their workflows. Think of a collection as a table or spreadsheet built directly into Layest — each collection holds records (called objects) that share a common set of fields (called attributes). Collections give your agents a persistent, queryable memory that goes well beyond conversation history, letting you build agents that track customers, manage tasks, log events, or store any domain-specific data your use case demands.

## What Are Data Collections?

A data collection is a named container for structured records. Every record in a collection follows the same schema — a set of attributes you define, such as a customer name, a status field, or a timestamp. Agents interact with collections at runtime: they can search for records that match certain criteria, create new records when they process new information, or update existing records as state changes.

Collections are the foundation of stateful agent behavior in Layest. When an agent needs to remember something beyond the current conversation — or when multiple agents need to share information — collections provide the shared, persistent layer that makes that possible.

## Creating a New Collection

<Steps>
  <Step title="Open the Data section">
    In the left sidebar, click **Data**, then select **Collections**. You will see a list of all collections already defined in your workspace.
  </Step>

  <Step title="Click New Collection">
    Click the **New Collection** button in the top-right corner. A creation dialog opens.
  </Step>

  <Step title="Name your collection">
    Enter a clear, descriptive name for your collection. Collection names must be unique within a workspace. Use names that reflect the data they hold, such as `Customer Leads` or `Support Tickets`.
  </Step>

  <Step title="Add a description (optional)">
    Add a short description so teammates and agents understand what this collection is for.
  </Step>

  <Step title="Define your initial attributes">
    Add the fields your objects will have. You can always add or edit attributes later. See [Attributes](/data/attributes) for the full list of supported field types.
  </Step>

  <Step title="Save the collection">
    Click **Create Collection**. Your new collection appears in the list and is immediately available to agents you authorize.
  </Step>
</Steps>

## Collection Schema: Defining Fields

Every collection has a schema — the set of attributes that describe the structure of its objects. When you create a collection you define the initial schema, and you can modify it at any time from the collection's **Settings** tab.

Each attribute has a name, a type (text, number, date, boolean, and more), and optional constraints such as whether the field is required or has a default value. A well-designed schema makes it easier to filter records, write precise agent instructions, and keep your data clean.

For a full reference on attribute types and configuration, see the [Attributes](/data/attributes) guide.

## How Agents Interact with Collections

Agents interact with collections through built-in collection actions that you expose when configuring the agent. Once a collection is linked to an agent, the agent can:

* **Read objects** — query the collection to retrieve records matching specific criteria, such as "find all tickets with status = open."
* **Write objects** — create new records in the collection when it encounters new information.
* **Update objects** — modify fields on an existing record, for example changing a status from `pending` to `resolved`.
* **Delete objects** — remove records that are no longer needed, subject to the permissions you configure.

Agents reference collection data in their prompts using the results of read queries, which Layest automatically formats and injects into the agent's context at runtime.

```text theme={null}
You have access to the Support Tickets collection.
When a user asks about their ticket, query the collection
by email address and summarize the most recent open ticket.
```

## Filtering and Sorting Collection Data in the UI

The collection view in Layest lets you slice and explore your data without writing any code.

* **Filter** — click **Add Filter** and choose any attribute to filter by. Combine multiple filter conditions using AND or OR logic.
* **Sort** — click any column header to sort ascending or descending by that attribute.
* **Search** — use the search bar to perform a full-text search across text attributes in the collection.
* **Views** — save a combination of filters and sorts as a named view that you or your team can return to quickly.

Filters and sorts applied in the UI affect only what you see; they do not modify the underlying data or change how agents query the collection.

## Access Control: Which Agents and Users Can Access a Collection

By default, a newly created collection is not exposed to any agents. You control access explicitly from the collection's **Access** tab.

**Agent access** — toggle on each agent that should be able to interact with this collection. For each agent, choose the permission level:

| Permission | What the agent can do           |
| ---------- | ------------------------------- |
| Read       | Query and retrieve objects      |
| Write      | Create and update objects       |
| Full       | Read, write, and delete objects |

**User access** — workspace members with the Admin or Editor role can view and edit all collections. You can restrict Viewer-role members to specific collections from the **Access** tab.

<Note>
  The number of collections you can create depends on your Layest plan. Free workspaces are limited to 5 collections. Starter plans allow up to 25, and Growth and Enterprise plans support unlimited collections. See the [pricing page](https://layest.ai/pricing) for a full comparison.
</Note>
