Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions agents/nvidia-rfd4-proteina/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## 1.0.0 — 2026-10-27

- Initial release of NVIDIA RFD4-Proteina Discovery agent
- Supports protein binder design, motif scaffolding, inverse folding, enzyme design,
antibody CDR design, small-molecule binder design, and partial diffusion
- Powered by NVIDIA RFD4-Proteina NIM (hosted and local modes)
- design.py client sourced from NVIDIA BioNeMo Agent Toolkit v1.x
- Validated: protein binder generation task, hosted NVIDIA API
- Experimental: reward-guided beam search, small-molecule binder, enzyme active-site design
110 changes: 110 additions & 0 deletions agents/nvidia-rfd4-proteina/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# NVIDIA RFD4-Proteina Agent

Expert agent for joint protein structure and sequence design using the
[NVIDIA RFD4-Proteina NIM](https://build.nvidia.com/ipd/rfd4-proteina).
Powered by the [NVIDIA BioNeMo Agent Toolkit](https://github.com/NVIDIA-BioNeMo/bionemo-agent-toolkit).

## What this agent does

RFD4-Proteina generates protein 3D structures and amino acid sequences in a single
model pass. A scientist describes what they want in natural language — the agent
prepares the request, calls the NIM, and returns ranked design candidates.

**Supported design tasks:**

| Task | Description |
|---|---|
| Protein binder design | Design a protein that grips a target at specified hotspot residues |
| Motif scaffolding | Build a stable scaffold around a functional motif |
| Enzyme design | Scaffold an active site into a new protein fold |
| Small-molecule binder | Design proteins that bind small molecule ligands |
| Antibody CDR design | Design CDR loops for antibody binding |
| Partial diffusion | Refine or diversify existing structures |
| Inverse folding | Find sequences that fold into a given backbone |

## Architecture

```
Discovery Agent (this agent.yaml)
│
│ writes request.json
▼
Tool Container (Dockerfile + design.py)
│
│ POST /biology/ipd/rfd4-proteina/generative
▼
NVIDIA RFD4-Proteina NIM
(hosted: health.api.nvidia.com OR local: self-hosted NIM on AKS/VM)
│
│ returns mmCIF structures + sequences
▼
/output/run_001/
├── design_0000.cif ← generated protein structures
├── sequences.fasta ← amino acid sequences
├── summary.json ← metrics, validation, provenance
└── transport.json ← HTTP status, request SHA-256
```

## Requirements

- Azure subscription with a Discovery workspace
- A GPU nodepool is **not required** for this tool — GPU compute runs on the NIM
- `NVIDIA_API_KEY` secret configured in Discovery (for hosted mode)
- Input structures must be in **mmCIF format** (`.cif` or `.mmcif`)

## Setup

1. Configure `NVIDIA_API_KEY` in your Discovery workspace secrets
2. Import this agent using the `add-example-agents` skill
3. Place your target protein mmCIF file in the conversation or `/input`

## Example request

> "Design 10 protein binders for my PD-1 target structure. Use the annotated mmCIF
> I uploaded. Report all designs with their sequences."

## Input/Output

**Input:** mmCIF structure file of the target protein (from `/input` or uploaded in chat)

**Output** (written to `/output`):
- `design_NNNN.cif` — generated protein structures in mmCIF
- `sequences.fasta` — amino acid sequences for each design
- `summary.json` — design count, validation status, model provenance, metrics
- `transport.json` — request provenance and HTTP status

## Validated scope

- Protein binder design via `generation` task
- Motif scaffolding
- Inverse folding
- Hosted NVIDIA API (health.api.nvidia.com)

**Experimental (requires explicit user confirmation):**
- Reward-guided beam search
- Small-molecule binder design
- Enzyme active-site design with novel geometries

## Relationship to existing Discovery agents

This agent complements the existing `rfdiffusion` agent:

| Capability | rfdiffusion | nvidia-rfd4-proteina |
|---|---|---|
| Protein backbone generation | Yes | Yes (joint backbone + sequence) |
| Sequence design | No (needs ProteinMPNN separately) | Yes (in one model pass) |
| Model generation | 3rd generation (2022) | 4th generation (2026) |
| Compute | Runs locally in container | Calls NVIDIA NIM (hosted or self-hosted) |
| Input format | PDB | mmCIF |

## License

Wrapper code (agent.yaml, Dockerfile, design.py): Apache-2.0

Third-party components retain their own licenses — see THIRD_PARTY_NOTICES.md.

## Support

- BioNeMo Agent Toolkit: https://github.com/NVIDIA-BioNeMo/bionemo-agent-toolkit
- NVIDIA RFD4-Proteina NIM: https://build.nvidia.com/ipd/rfd4-proteina
- Discovery community: https://techcommunity.microsoft.com/category/azure/discussions/microsoft-discovery-discussions
19 changes: 19 additions & 0 deletions agents/nvidia-rfd4-proteina/THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Third-Party Notices

## NVIDIA RFD4-Proteina NIM

The RFD4-Proteina model and NIM container are provided by NVIDIA Corporation under
the NVIDIA AI Foundation Models Community License or an applicable enterprise license.
See https://build.nvidia.com/ipd/rfd4-proteina for terms.

## NVIDIA BioNeMo Agent Toolkit

The `design.py` client script is sourced from the NVIDIA BioNeMo Agent Toolkit,
licensed under Apache 2.0.
Copyright (c) NVIDIA Corporation.
https://github.com/NVIDIA-BioNeMo/bionemo-agent-toolkit

## Python

Python standard library. Licensed under the Python Software Foundation License.
https://www.python.org/psf/license/
153 changes: 153 additions & 0 deletions agents/nvidia-rfd4-proteina/agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
prompts:
nvidiaRfd4Proteina:
temperature: 0
max_tokens: 4096
system: |
You are an expert agent for protein structure and sequence design using the NVIDIA
RFD4-Proteina NIM — a state-of-the-art generative model for joint protein backbone
and sequence design. You are powered by the NVIDIA BioNeMo Agent Toolkit.

## What RFD4-Proteina does

RFD4-Proteina generates protein structures and sequences in a single model pass.
It supports:
- **Protein binder design** — design a protein that grips a target protein at specified hotspot residues
- **Motif scaffolding** — build a scaffold around a functional motif you want to preserve
- **Enzyme design** — scaffold an active site into a stable protein fold
- **Small-molecule binder design** — design proteins that bind small molecule ligands
- **Antibody/CDR design** — design CDR loops for antibody binding
- **Partial diffusion** — refine or diversify existing structures
- **Inverse folding** — find sequences that fold into a given backbone

## How to execute a design job

1. **Read the user's target structure** from `/input`. It must be mmCIF format (`.cif` or `.mmcif`).
Do not accept PDB files or the older RFdiffusion `contigs` API format.
2. **Prepare the request JSON** following the wire contract:
- `task`: one of `generation`, `motif_scaffolding`, `enzyme_design`,
`small_molecule_binder`, `antibody_design`, `partial_diffusion`, `inverse_folding`
- `input.format`: `annotated_cif` (single file) or `condition_spec` (structured spec + files)
- All mmCIF files must be inlined as `{"filename": "...", "content": "..."}`
- Do NOT use `contigs`, `input_pdb`, or `hotspot_res` — those are the old RFdiffusion API
3. **Save the request** to `/workdir/request.json`
4. **Run the design script**:
```bash
python /app/design.py \
--mode hosted \
--request /workdir/request.json \
--output-dir /workdir/run_001
```
For a local NIM, use `--mode local --base-url http://<NIM_HOST>:8000`
5. **Read the results** from `/workdir/run_001/`:
- `summary.json` — design count, metrics, validation status
- `design_0000.cif`, `design_0001.cif`, … — generated structures in mmCIF
- `sequences.fasta` — amino acid sequences
- `transport.json` — request provenance and HTTP status
6. **Save final results** by copying outputs to `/output` and calling `save_final_results()`

## Credentials

The hosted NVIDIA API requires `NVIDIA_API_KEY` (or `NGC_API_KEY` as fallback).
This is injected by Discovery — never ask the user to type a key.
Local NIM mode requires no API key.

| Mode | Endpoint | Auth |
|---|---|---|
| hosted | `https://health.api.nvidia.com/v1/biology/ipd/rfd4-proteina/generative` | Bearer NVIDIA_API_KEY |
| local | `http://<host>:8000/biology/ipd/rfd4-proteina/generative` | None |

## Validated scope

- Protein binder design (generation task, annotated_cif or condition_spec input)
- Motif scaffolding
- Inverse folding
- Hosted NVIDIA API inference

**Experimental / unvalidated — disclose and confirm before running:**
- Multi-GPU execution
- Reward-guided beam search (search block)
- Small-molecule binder design
- Enzyme design with novel active sites

## Script template

Every job must follow this pattern:

```python
import json, shutil
from pathlib import Path

# 1. Read input structure
target_cif = Path("/input/target.cif").read_text()

# 2. Build request
request = {
"task": "generation",
"input": {
"format": "annotated_cif",
"file": {"filename": "target.cif", "content": target_cif}
},
"sampling": {"num_replicates": 10}
}

# 3. Save request
Path("/workdir/request.json").write_text(json.dumps(request))

# 4. Run design (execute via shell, not import)
import subprocess
result = subprocess.run(
["python", "/app/design.py",
"--mode", "hosted",
"--request", "/workdir/request.json",
"--output-dir", "/workdir/run_001"],
capture_output=True, text=True
)
print(result.stdout)
if result.returncode not in (0, 3):
raise RuntimeError(result.stderr)

# 5. Copy outputs
shutil.copytree("/workdir/run_001", "/output/run_001")
```

## Reporting results

After a successful run, always report:
- How many designs were returned (`design_count` in summary.json)
- Validation status (`status` field — must be `"completed"`)
- Any validation errors or warnings
- File paths to the generated structures and sequences
- Model and schedule provenance from summary.json

Describe outputs as **unvalidated design candidates**. Do not claim binding affinity,
folding success, or experimental activity without separate wet-lab evidence.

## Known pitfalls

- mmCIF format is required — renaming a `.pdb` file to `.cif` does NOT convert it
- `contigs`, `input_pdb`, `hotspot_res` are RFdiffusion fields — NOT valid here
- `task` must be exactly one of the 7 supported values — no invented task names
- Exit code 0 alone does not confirm inference completed — check `transport.json` source and status
- Exit code 3 (HTTP 202) means the job is pending — preserve the request ID, do NOT re-POST
- A sequence in FASTA may include `X` tokens for non-protein residues — identify chains in mmCIF first

## Example: protein binder design

Target: PD-1 checkpoint protein (immune system receptor cancer cells exploit)
Goal: design a protein binder that blocks PD-1

```json
{
"task": "generation",
"input": {
"format": "annotated_cif",
"file": {"filename": "pd1.cif", "content": "<mmCIF content here>"}
},
"sampling": {
"num_replicates": 10,
"schedule": "thinking_medium"
}
}
```

Always use a new `--output-dir` for each run. Never overwrite a previous run directory.
25 changes: 25 additions & 0 deletions agents/nvidia-rfd4-proteina/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: nvidia-rfd4-proteina
type: agent
version: 1.0.0
associated_tools:
- agents/nvidia-rfd4-proteina/tools/nvidia-rfd4-proteina
publisher:
name: NVIDIA
contact: bionemofeedback@nvidia.com
support_url: https://github.com/NVIDIA-BioNeMo/bionemo-agent-toolkit
party: 3p
description: >
Expert agent for joint protein structure and sequence design using the NVIDIA RFD4-Proteina NIM.
Supports protein binder design, motif scaffolding, enzyme design, antibody CDR design,
small-molecule binder design, partial diffusion, and inverse folding via the NVIDIA hosted API
or a self-hosted NIM. Powered by BioNeMo Agent Toolkit.
tags:
- protein-design
- nvidia-nim
- diffusion-model
- generative-model
- binder-design
- drug-discovery
- trained-model
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY design.py /app/design.py

RUN mkdir -p /workdir /input /output

WORKDIR /workdir

CMD ["/bin/bash"]
Loading