Skip to content

Using Dock2MD Safely With AI Coding Agents

AI coding agents increasingly assemble computational chemistry pipelines on the fly — and frequently fail silently when orchestrating raw command-line tools (obabel, gmx pdb2gmx, custom RDKit scripts), where an agent can coerce a broken receptor or wrong stereoisomer into exiting with code 0.

Dock2MD is explicitly engineered to serve as a deterministic contract layer for both human researchers and autonomous LLM agents.

1. Invoke via dock2md or python -m dock2md (Never main())

Section titled “1. Invoke via dock2md or python -m dock2md (Never main())”
Terminal window
# CORRECT — preserves exact integer exit code
dock2md reconstruct-ligand -d pose.pdbqt -l ref.sdf -o out.sdf
python -m dock2md build -r receptor.pdb -d pose.pdbqt -l ref.sdf --mode md -o out/
# WRONG — discards main()'s return value so refusals look like exit 0!
python -c "from dock2md.cli import main; main()"

2. Always Preflight With validate-config First

Section titled “2. Always Preflight With validate-config First”

Before launching expensive docking, PLIP, or MD jobs, let the agent run:

Terminal window
dock2md validate-config --kind auto workflow.yaml

This catches schema typos, unedited A:*** / CHEMBL*** placeholders, mistyped receptor residues, and incompatible engine/metric pairs in under 0.7 seconds with exact corrective hints.

3. Parse DOCK2MD_OUTCOME: Instead of Guessing From Free Text

Section titled “3. Parse DOCK2MD_OUTCOME: Instead of Guessing From Free Text”

When a command fails, inspect returncode and scan stderr for the machine-readable DOCK2MD_OUTCOME: marker plus the structured Expected: / Found: / Suggestion: lines:

  • Typed Refusal (ChiralInversionError, StereochemicalAmbiguityError, missing reference, receptor gap, metal site, config error): STOP and report or fix the input — do not bypass the gate by stripping chemistry or passing --no-validate.
  • Unhandled Crash: Unexpected runtime exception — capture full stderr and abort cleanly.

4. Inspect run_manifest.json for Ground-Truth Counts

Section titled “4. Inspect run_manifest.json for Ground-Truth Counts”

Never infer completion counts from terminal stdout alone. Read run_manifest.json (and interactions.summary.csv) for exact discovered / eligible / reconstructed / refused / PLIP counts and SHA-256 checksums.


Point your agent directly at our standardized LLM files:

Cross-Model Agent Benchmark Summary (v0.5.0)

Section titled “Cross-Model Agent Benchmark Summary (v0.5.0)”

In a 36-block, 6-trap cross-model crossover (Claude Sonnet 5.5 and Gemini 4 Carbon):

  • Generic prompts using raw tools accumulated silent policy coercions and ad-hoc glue scripts.
  • Giving agents Dock2MD CLI with the same generic prompt matched an oracle explicit-rules prompt on trap refusals (72/72) and structured provenance (8/8) without needing custom prompt-engineered guardrails or unreviewed helper scripts.