# Chai1

> Skill for biomolecular structure prediction with Chai-1 from Chai Discovery. Use this skill when a user wants to predict protein structures, protein-ligand complexes, protein-nucleic acid complexes, or multi-chain biomolecular assemblies. Also trigger when the user mentions Chai-1, chai-lab, or wants an AlphaFold3/Boltz-2 alternative that supports proteins, small molecules, RNA, and DNA. Chai-1 i…

- **Type:** Skill
- **Install:** `agentstack add skill-naity-fm4life-chai1`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [naity](https://agentstack.voostack.com/s/naity)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [naity](https://github.com/naity)
- **Source:** https://github.com/naity/FM4Life/tree/main/skills/chai1

## Install

```sh
agentstack add skill-naity-fm4life-chai1
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Chai-1: Biomolecular Structure Prediction

## Overview

Chai-1 is a multimodal structure prediction model that handles proteins, small molecules, RNA, DNA, and modifications in a single unified framework. It is a direct competitor to AlphaFold 3 and Boltz-2.

**Key differentiators:**
- Apache 2.0 license (commercial use explicitly permitted, including drug discovery)
- Simple pip install + FASTA-like input format
- Returns PAE, PDE, pLDDT, pTM, ipTM confidence metrics
- Optional MSA server integration (ColabFold MMseqs2)
- Supports templates, restraints, and covalent bonds

**Supported entity types:**
- `protein` — amino acid sequences
- `ligand` — SMILES-encoded small molecules
- `rna` — RNA sequences
- `dna` — DNA sequences
- Modified residues (e.g., phosphoserine: `AAA(SEP)AAA`)

## Installation

```bash
pip install chai_lab==0.6.1
```

Requirements: Python ≥ 3.10, Linux, CUDA GPU with bfloat16 support.

Recommended GPUs: A100 (80GB), H100 (80GB), L40S (48GB). Also works on A10, A30, RTX 4090 for smaller complexes.

Model weights download automatically on first run to `~/.chai/` (or `$CHAI_DOWNLOADS_DIR`).

## Input Format

Chai-1 uses a **FASTA-like format** with entity type headers:

```fasta
>protein|name=receptor
AGSHSMRYFSTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAA...

>protein|name=peptide
GAAL

>ligand|name=inhibitor
CC(=O)Nc1ccc(O)cc1

>rna|name=guide_rna
AUGCUAGCUAGC

>dna|name=template
ATGCTAGCTAG
```

- Each entity needs a unique `name=` identifier
- All entities in one file form a complex
- Ligands use SMILES notation
- Modified residues use parenthetical notation: `AAA(SEP)AAA` (phosphoserine at position 4)

## Core Usage

### Python API

```python
from pathlib import Path
from chai_lab.chai1 import run_inference

candidates = run_inference(
    fasta_file=Path("input.fasta"),
    output_dir=Path("output/"),
    num_trunk_recycles=3,
    num_diffn_timesteps=200,
    num_diffn_samples=5,
    seed=42,
)

# Access results
for i, (cif_path, ranking) in enumerate(zip(candidates.cif_paths, candidates.ranking_data)):
    score = ranking.aggregate_score.item()
    print(f"Sample {i}: {cif_path}  aggregate_score={score:.3f}")

# Confidence tensors
plddt = candidates.plddt   # (num_samples, num_tokens)
pae   = candidates.pae     # (num_samples, num_tokens, num_tokens)
pde   = candidates.pde     # (num_samples, num_tokens, num_tokens)
```

### CLI

```bash
# Basic prediction (no MSA)
chai-lab fold input.fasta output_folder/

# With MSA server (more accurate)
chai-lab fold --use-msa-server input.fasta output_folder/

# With MSA + templates
chai-lab fold --use-msa-server --use-templates-server input.fasta output_folder/

# Convert a3m MSA to chai format
chai-lab a3m-to-pqt input_a3m_dir/ output.pqt
```

## Key Parameters

| Parameter | Default | Description |
|---|---|---|
| `num_trunk_recycles` | 3 | Recycling iterations (more = slower, better) |
| `num_diffn_timesteps` | 200 | Diffusion denoising steps |
| `num_diffn_samples` | 5 | Structures generated per trunk sample |
| `num_trunk_samples` | 1 | Independent trunk sampling runs |
| `use_esm_embeddings` | True | Use ESM protein language model embeddings |
| `use_msa_server` | False | Query ColabFold MMseqs2 server for MSA |
| `msa_server_url` | `https://api.colabfold.com` | MSA server endpoint |
| `use_templates_server` | False | Fetch PDB templates from server |
| `low_memory` | True | Offload tensors to CPU between operations |
| `seed` | None | Random seed for reproducibility |
| `device` | None | Torch device (default: `cuda:0`) |
| `fasta_names_as_cif_chains` | False | Use entity names as mmCIF chain IDs |

## Output Format

```
output_folder/
├── pred.model_idx_0.cif          ← best structure (mmCIF)
├── pred.model_idx_1.cif
├── ...
├── scores.model_idx_0.npz        ← confidence arrays
└── msa_coverage.png              ← MSA depth plot (if MSA used)
```

Scores NPZ arrays (per candidate):
- `plddt` — per-token pLDDT (0–100)
- `pae` — predicted aligned error matrix (N×N, Å)
- `pde` — predicted distance error matrix (N×N, Å)

`SampleRanking` fields (from `candidates.ranking_data[i]`):
- `aggregate_score` — primary ranking metric (higher = better)
- `ptm_scores.complex_ptm` — global fold quality (0–1)
- `ptm_scores.interface_ptm` — interface confidence (0–1)
- `plddt_scores` — per-chain pLDDT

## Confidence Metrics

| Metric | Range | Interpretation |
|---|---|---|
| `aggregate_score` | 0–1 | Primary ranking; combine pTM + clash + pLDDT |
| `complex_ptm` | 0–1 | Overall fold quality (>0.5 = good) |
| `interface_ptm` (ipTM) | 0–1 | Interface confidence (>0.6 = confident) |
| `plddt` per-residue | 0–100 | Local confidence (>70 = reliable) |
| PAE (Å) | 0–31 | Position error; low = confident relative placement |

For complexes, filter by `interface_ptm > 0.6` as the primary criterion.

## MSA Handling

By default, Chai-1 runs without MSA (fast but less accurate). For best results:

```python
# Option 1: use server (requires internet)
candidates = run_inference(
    fasta_file=Path("input.fasta"),
    output_dir=Path("output/"),
    use_msa_server=True,
)

# Option 2: precomputed MSA directory
candidates = run_inference(
    fasta_file=Path("input.fasta"),
    output_dir=Path("output/"),
    msa_directory=Path("msas/"),   # contains aligned.pqt files
)
```

## Scripts

- `scripts/predict.py` — predict structures from FASTA input; see `scripts/predict.py --help`

## Resources

- **GitHub:** https://github.com/chaidiscovery/chai-lab
- **Paper:** Chai Discovery, bioRxiv 2024 — https://doi.org/10.1101/2024.10.10.615955
- **Web app:** https://lab.chaidiscovery.com (no local setup required)

## References

- `references/api-reference.md` — full Python API reference, confidence metric details, restraints, covalent bonds, template handling

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [naity](https://github.com/naity)
- **Source:** [naity/FM4Life](https://github.com/naity/FM4Life)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** yes
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-naity-fm4life-chai1
- Seller: https://agentstack.voostack.com/s/naity
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
