$npx -y skills add KevinSpringer1/conserved-primer-design --skill agentskillUse when an agent needs to call the VirusPrimerPro Agent API instead of the GUI, or prepare viral genome inputs for it: request/use API keys, download viral genomes from NCBI, install/run MAFFT, check and repair abnormal sequences, prepare phylogenetic trees/annotations, upload a
| 1 | # VirusPrimerPro Agent API |
| 2 | |
| 3 | Use this skill when a task requires calling VirusPrimerPro through `/api/v1/agent/*` rather than the browser GUI. The API is asynchronous: submit files and parameters, start the run, then poll status until `succeeded` or `failed`. |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | Prefer environment variables so secrets do not appear in prompts, logs, or commits: |
| 8 | |
| 9 | ```bash |
| 10 | export VPP_AGENT_BASE_URL="http://127.0.0.1:3006" |
| 11 | export VPP_AGENT_API_KEY="vpp_live_<prefix>_<secret>" |
| 12 | ``` |
| 13 | |
| 14 | For admin-only key issuance: |
| 15 | |
| 16 | ```bash |
| 17 | export VPP_AGENT_ADMIN_TOKEN="<admin token>" |
| 18 | ``` |
| 19 | |
| 20 | ## Preferred Helper |
| 21 | |
| 22 | Use the bundled standard-library Python helper for reliable uploads and polling: |
| 23 | |
| 24 | ```bash |
| 25 | python agentskill/scripts/vpp_agent_api.py \ |
| 26 | --base-url "$VPP_AGENT_BASE_URL" \ |
| 27 | --api-key-env VPP_AGENT_API_KEY \ |
| 28 | submit \ |
| 29 | --msa aligned.fasta \ |
| 30 | --profile standard \ |
| 31 | --config-json '{"mode":"primer_site","target_coverage":0.95,"amplicon_min":100,"amplicon_max":400}' \ |
| 32 | --wait \ |
| 33 | --poll-interval 30 \ |
| 34 | --output-dir results |
| 35 | ``` |
| 36 | |
| 37 | Import the helper when building a larger agent workflow: |
| 38 | |
| 39 | ```python |
| 40 | from pathlib import Path |
| 41 | from agentskill.scripts.vpp_agent_api import VirusPrimerProClient |
| 42 | |
| 43 | client = VirusPrimerProClient.from_env() |
| 44 | run = client.submit_primer_site_run( |
| 45 | msa_path=Path("aligned.fasta"), |
| 46 | config={"mode": "primer_site", "target_coverage": 0.95}, |
| 47 | profile="standard", |
| 48 | wait=True, |
| 49 | poll_interval=30, |
| 50 | ) |
| 51 | print(run["status"]) |
| 52 | ``` |
| 53 | |
| 54 | ## Workflow |
| 55 | |
| 56 | 1. Ensure the agent has an approved API key. If not, call `apply-key` and wait for an administrator to approve and issue a key. |
| 57 | 2. Create a run with top-level `mode`, `profile`, `config`, and file metadata. |
| 58 | 3. Upload each file in chunks. The chunk upload path must include `/parts/{part_no}`. |
| 59 | 4. Call `/start`. It returns quickly with `queued`; do not wait on the HTTP request. |
| 60 | 5. Poll `GET /api/v1/agent/runs/{run_id}` every 30 seconds, or longer for heavy runs. |
| 61 | 6. On `succeeded`, fetch `/result` and artifacts. On `failed`, report `process_exit_code`, `warning_flags`, and any available artifacts. |
| 62 | |
| 63 | Status handling: |
| 64 | |
| 65 | - `created` or `uploading`: finish missing uploads, then call `start`. |
| 66 | - `queued`: worker has not started; wait and poll again. |
| 67 | - `running`: computation is active; wait and poll again. |
| 68 | - `succeeded`: fetch result and artifacts. |
| 69 | - `failed`: surface the error metadata and available artifacts. |
| 70 | - `aborted`: the upload run was cancelled before queueing. |
| 71 | |
| 72 | ## PhyloGuide Preparation |
| 73 | |
| 74 | For `phylo_guide`, prepare the tree and annotation before calling `submit`. Do not invent genotype groups from the sequence names. Use literature or curated references for the target species, then make those groups explicit in a `groups.json` file. |
| 75 | |
| 76 | ```bash |
| 77 | python agentskill/scripts/vpp_agent_api.py prepare-phylo \ |
| 78 | --msa aligned.fasta \ |
| 79 | --groups-file groups.json \ |
| 80 | --species "Target species name" \ |
| 81 | --reference-id NC_000000 \ |
| 82 | --target-group GenotypeA \ |
| 83 | --citation "Author Year DOI/PMID or URL" \ |
| 84 | --out-dir phylo_ready |
| 85 | ``` |
| 86 | |
| 87 | Then submit: |
| 88 | |
| 89 | ```bash |
| 90 | python agentskill/scripts/vpp_agent_api.py \ |
| 91 | --base-url "$VPP_AGENT_BASE_URL" \ |
| 92 | --api-key-env VPP_AGENT_API_KEY \ |
| 93 | submit \ |
| 94 | --mode phylo_guide \ |
| 95 | --msa phylo_ready/aligned.normalized.fasta \ |
| 96 | --tree phylo_ready/tree.newick \ |
| 97 | --annotation-file phylo_ready/annotation.json \ |
| 98 | --config-json '{"mode":"phylo_guide"}' \ |
| 99 | --wait |
| 100 | ``` |
| 101 | |
| 102 | Read `references/phylo_prepare.md` before preparing a PhyloGuide job. |
| 103 | |
| 104 | ## NCBI + MAFFT Preparation |
| 105 | |
| 106 | Use `agentskill/scripts/ncbi_mafft.py` when the agent must download viral genomes from NCBI, install or run MAFFT, check alignment quality, or repair abnormal sequences. |
| 107 | |
| 108 | ```bash |
| 109 | python agentskill/scripts/ncbi_mafft.py install-mafft |
| 110 | |
| 111 | python agentskill/scripts/ncbi_mafft.py download-ncbi \ |
| 112 | --query '"Target virus"[Organism] AND "complete genome"[Title]' \ |
| 113 | --max-records 50 \ |
| 114 | --output ncbi_raw.fasta \ |
| 115 | --manifest ncbi_manifest.json |
| 116 | |
| 117 | python agentskill/scripts/ncbi_mafft.py pipeline \ |
| 118 | --input ncbi_raw.fasta \ |
| 119 | --out-dir mafft_ready \ |
| 120 | --thread 4 \ |
| 121 | --adjust-direction \ |
| 122 | --drop-reason empty_after_removing_gaps \ |
| 123 | --drop-reason high_n_fraction |
| 124 | ``` |
| 125 | |
| 126 | Use `mafft_ready/aligned.repaired.fasta` as the MSA for `prepare-phylo` or `submit`. Read `references/ncbi_mafft.md` before running the pipeline. |
| 127 | |
| 128 | ## Safety Rules |
| 129 | |
| 130 | - Never print, commit, or write the full API key unless the user explicitly asks to capture a newly issued key. |
| 131 | - Prefer `Authorization: Bearer ...`; `X-API-Key` is also accepted. |
| 132 | - Use top-level `profile`; the API treats it as authoritative and overwrites conflicting `config.primer_site_profile`. |
| 133 | - `high_coverage` and `di |