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

# Manage Collections

> Create, list, update, and delete collections

A collection is a container for agent runs, rubrics, and evaluation results.
See [Introduction](https://docs.transluce.org/introduction.md) for more on how collections fit into the Docent workflow.

## Create a Collection

```python theme={null}
from docent import Docent

client = Docent()

collection_id = client.create_collection(
    name="GPT-4 Customer Support Runs",
    description="Production runs from the support agent",
    metadata={"team": "support", "model": "gpt-4"},
)
print(collection_id)  # e.g., "a1b2c3d4-..."
```

> [!NOTE]
>
> Organization service accounts require `write` or `admin` permission to
> create a collection. The service account's organization owns the resulting
> collection and receives a stored `admin` grant. In customer-hosted
> deployments, `collection_organization_member_max_permission` can reduce the
> effective permission for ordinary organization members while preserving
> collection administration for organization administrators.

### Parameters

**collection\_id** `str | None`

Optional ID for the new collection. If not provided, one is generated automatically.

**name** `str | None`

Display name for the collection.

**description** `str | None`

Description of the collection's purpose.

**metadata** `dict | None`

Arbitrary key-value metadata to attach to the collection.

### Returns

**collection\_id** `str`

The ID of the created collection.

***

## List Collections

```python theme={null}
collections = client.list_collections()
for c in collections:
    print(f"{c['id']}: {c['name']} ({c['counts']['agent_run_count']} runs)")
```

### Returns

**collections** `list[dict]`

List of collection summary objects, including ownership, your permission level, and precomputed counts.

**Collection object fields**

**id** `str`

Collection ID.

**name** `str | None`

Display name.

**description** `str | None`

Description.

**created\_at** `str`

ISO timestamp of creation.

**created\_by** `str`

User ID of the creator.

**owner** `dict`

Owner of the collection.

**Owner fields**

**id** `str`

Owner user ID.

**email** `str`

Owner email.

**is\_anonymous** `bool`

Whether the owner is an anonymous user.

**is\_owner** `bool`

`True` if the requesting user owns the collection.

**my\_permission** `str`

Requesting user's permission level on the collection: `"read"`, `"write"`, or `"admin"`.

**counts** `dict`

Precomputed counts for the collection.

**Counts fields**

**agent\_run\_count** `int`

Number of agent runs in the collection.

***

## Get a Collection

```python theme={null}
import requests

try:
    collection = client.get_collection("my-collection-id")
    print(collection["name"])
except requests.exceptions.HTTPError as e:
    if e.response.status_code == 404:
        print("Collection not found")
    else:
        raise
```

### Parameters

**collection\_id** `str` *required*

ID of the collection to retrieve.

### Returns

**collection** `dict`

Collection details with ownership, your permission level, and precomputed counts.

**Collection object fields**

**id** `str`

Collection ID.

**name** `str | None`

Display name.

**description** `str | None`

Description.

**created\_at** `str`

ISO timestamp of creation.

**created\_by** `str`

User ID of the creator.

**owner** `dict`

Owner of the collection.

**Owner fields**

**id** `str`

Owner user ID.

**email** `str`

Owner email.

**is\_anonymous** `bool`

Whether the owner is an anonymous user.

**is\_owner** `bool`

`True` if the requesting user owns the collection.

**my\_permission** `str`

Requesting user's permission level on the collection: `"read"`, `"write"`, or `"admin"`.

**counts** `dict`

Precomputed counts for the collection.

**Counts fields**

**agent\_run\_count** `int`

Number of agent runs in the collection.

> [!NOTE]
>
> The metadata blob is no longer included on this response. Use [`get_collection_metadata`](https://docs.transluce.org/sdk/collections/metadata) to retrieve it.

### Errors

* **`HTTPError (404)`** — Collection not found

***

## Update a Collection

```python theme={null}
client.update_collection(
    "my-collection-id",
    name="Renamed Collection",
    description="Updated description",
)
```

### Parameters

**collection\_id** `str` *required*

ID of the collection to update.

**name** `str | None`

New name. If `None`, the name is left unchanged.

**description** `str | None`

New description. If `None`, the description is left unchanged.

***

## Delete Agent Runs

Remove specific agent runs from a collection.

```python theme={null}
deleted = client.delete_agent_runs("my-collection-id", ["run-1", "run-2"])
print(f"Deleted {deleted} runs")
```

### Parameters

**collection\_id** `str` *required*

ID of the collection.

**agent\_run\_ids** `list[str]` *required*

List of agent run IDs to delete.

### Returns

**deleted\_count** `int`

Number of agent runs deleted.

### Errors

* **`ValueError`** — `agent_run_ids` is empty
* **`HTTPError (404)`** — Collection not found


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.