Skip to content

K-Dense-AI/scientific-agent-skills / skills/latchbio-integration

latchbio-integration

Verified

Builds, registers, debugs, and operates bioinformatics workflows on Latch using the Python SDK, CLI, Latch Data and Registry, Nextflow, Snakemake, programmatic execution, and Latch MCP. Use when authoring or deploying Latch workflows, configuring resources or interfaces, moving data, integrating Registry, or launching and monitoring runs.

references/registry.md

View on GitHub
# Latch Registry SDK

The current Registry API is object- and transaction-based. Older examples that
call `Project.create`, `Table.create`, `Record.create`, `Record.list`,
`record.update`, or `record.delete` do not match the current SDK.

This reference targets `latch==2.77.1`.

## Object Model

```text
Account (workspace)
└── Project
    └── Table
        └── Record
```

Current classes:

```python
from latch.account import Account
from latch.registry.project import Project
from latch.registry.record import Record
from latch.registry.table import Table
```

Objects are identified by numeric-string IDs. Display names are not globally
unique and must not be used as stable identifiers.

## Read Projects and Tables

```python
from latch.account import Account

account = Account.current()

for project in account.list_registry_projects():
    print(project.id, project.get_display_name())

    for table in project.list_tables():
        print("  ", table.id, table.get_display_name())
```

Most getters lazily call `load()` and cache the result. Use `load()` explicitly
when another process may have changed an object and fresh state is required.

Permissions are evaluated in the active CLI workspace or the workspace running
the task.

## Read Records

`Table.list_records()` is paginated and yields dictionaries keyed by record ID:

```python
from latch.registry.table import Table

table = Table(id="12345")

for page in table.list_records(page_size=100):
    for record_id, record in page.items():
        print(
            record_id,
            record.get_name(),
            record.get_values(),
            record.get_creation_time(),
            record.get_last_updated(),
        )
```

`page_size` must be positive. The SDK uses limit/offset pagination and sorts by
record ID; concurrent edits can change the result set between pages. Export a
quiescent table when a consistent scientific snapshot is required.

Record names are unique only within their table. Use `record.id` when a global
identifier is required.

To load one known record:

```python
from latch.registry.record import Record

record = Record(id="67890")
values = record.get_values()
table_id = record.get_table_id()
```

## DataFrames

`Table.get_dataframe()` requires the pandas extra:

```bash
uv pip install "latch[pandas]==2.77.1"
```

```python
frame = Table(id="12345").get_dataframe()
```

Use `list_records()` when streaming or dependency minimization matters.

## Transactional Updates

Updates are queued in a context manager and committed atomically when the
context exits successfully.

### Create a project

```python
from latch.account import Account

account = Account.current()
with account.update() as update:
    update.upsert_registry_project("RNA-seq Studies")
```

Despite the method name, creating projects and tables is not idempotent: two
calls with the same display name create two objects.

### Create a table

```python
from latch.registry.project import Project

project = Project(id="123")
with project.update() as update:
    update.upsert_table("Samples")
```

### Add columns and records

```python
from latch.registry.table import Table
from latch.types import LatchFile

table = Table(id="456")

with table.update() as update:
    update.upsert_column("condition", str, required=True)
    update.upsert_column("replicate", int)
    update.upsert_column("reads", LatchFile)

with table.update() as update:
    update.upsert_record(
        "sample-001",
        condition="treated",
        replicate=1,
        reads=LatchFile("latch:///inputs/sample-001.fastq.gz"),
    )
```

`upsert_record` takes the record name followed by column values as keyword
arguments. Unknown columns raise an error.

Supported column types include strings, integers, floats, dates, datetimes,
Booleans, `LatchFile`, `LatchDir`, enums, linked records, and selected list
forms. Check `TableUpdate.upsert_column` in the installed SDK before using a
less common nested type.

`TableUpdate.upsert_record` accepts `LPath` values in SDK 2.67.22 and later:

```python
from latch.ldata.path import LPath

with table.update() as update:
    update.upsert_record(
        "sample-002",
        reads=LPath("latch:///inputs/sample-002.fastq.gz"),
    )
```

### Delete

Deletion is queued through the corresponding updater:

```python
with table.update() as update:
    update.delete_record("sample-001")

with project.update() as update:
    update.delete_table("456")

with account.update() as update:
    update.delete_registry_project("123")
```

Record deletion takes a record **name**. Table and project deletion take IDs.
Confirm destructive operations and the active workspace first.

## Registry Samplesheets in Workflow Forms

`SamplesheetItem` preserves the source Registry record when a user imports rows
into a workflow form.

```python
from dataclasses import dataclass

from latch import small_task, workflow
from latch.registry.table import Table
from latch.types import LatchFile
from latch.types.metadata import (
    LatchAuthor,
    LatchMetadata,
    LatchParameter,
)
from latch.types.samplesheet_item import SamplesheetItem


@dataclass
class SampleRow:
    sample_name: str
    reads: LatchFile
    qc_status: str


metadata = LatchMetadata(
    display_name="Registry-aware QC",
    author=LatchAuthor(name="Workflow Team"),
    parameters={
        "samples": LatchParameter(
            display_name="Samples",
            samplesheet=True,
        )
    },
)


@small_task
def process_samples(samples: list[SamplesheetItem[SampleRow]]) -> int:
    updated = 0

    for item in samples:
        if item.record is None:
            continue

        table = Table(id=item.record.get_table_id())
        with table.update() as update:
            update.upsert_record(
                item.record.get_name(),
                qc_status="complete",
            )
        updated += 1

    return updated


@workflow(metadata)
def registry_qc(samples: list[SamplesheetItem[SampleRow]]) -> int:
    return process_samples(samples=samples)
```

Important behavior:

- `item.data` is the typed dataclass value.
- `item.record` is a `Record` when imported from Registry.
- `item.record` is `None` for a manually entered row.
- Dataclass fields should match Registry column keys where possible.
- The target table must already contain columns written by the task.
- Restrict selectable tables with `LatchParameter.allowed_tables` when the
  workflow should not accept arbitrary Registry schemas.

## Consistency and Error Handling

- Call `load()` again after out-of-band changes.
- Treat `NotFoundError` variants as either absent objects or missing permission.
- Do not infer IDs by choosing the first matching display name.
- Keep transactions focused; a failure prevents the context's commit.
- Avoid one transaction per row when a single updater can batch many changes.
- Validate all paths and types before queuing a large update.
- Record provenance fields rather than overwriting source metadata.

## Official Sources

- Registry SDK overview: https://wiki.latch.bio/registry/sdk/latch-sdk-registry-integration
- Account objects: https://wiki.latch.bio/registry/sdk/account-objects
- Project objects: https://wiki.latch.bio/registry/sdk/registry-projects
- Table objects: https://wiki.latch.bio/registry/sdk/table-objects
- Record objects: https://wiki.latch.bio/registry/sdk/record-objects
- Workflow Registry tutorial: https://wiki.latch.bio/workflows/sdk/api/registry-usage-tutorial
- Registry source in the 2.77.1 release commit: https://github.com/latchbio/latch/tree/b3768e65c6d496868f6e530f11977d857ad85dc7/src/latch/registry
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall