Skip to main content
The Phylo API lets you run an analysis programmatically and check its result automatically. This example runs an analysis based on BiomniBench-DA task da-18-7, then starts a second Biomni task to grade the result. Both tasks run on GPT 6 Astra (model="custom:gpt-6-astra"), the model we recommend for the highest-quality analyses. To make sure every task uses the model you chose, this recipe sets disable_fallbacks.
custom: models must be enabled for your workspace. If creating a task returns 403, ask your Phylo representative to enable them, or set model="max" to run on the Max tier instead.
This recipe launches two Biomni tasks:
  1. The first task runs the analysis
  2. The second task grades the results of the first task

Prerequisites

  • An API key
  • Python 3.10 or later with the requests package
Install requests, then set your API key:
The script uses https://api.phylo.bio/v1. If you’re an Enterprise customer, set PHYLO_BASE_URL environment variable to the API base URL shared by your Phylo representative.

Run the analysis

1

Set up a Python client

For the purposes of this recipe, we’ll use the Python client recipe. Open Building a Python client, save the client as phylo_client.py, and place it in the directory where you will run the analysis. The analysis script imports PhyloClient from that file.
2

Create the analysis script

Save this script – which includes prompts for the analysis and grading – as analysis.py beside phylo_client.py:
analysis.py
3

Run the script

Run the analysis from the directory containing both Python files:
The script downloads the public cBioPortal study archive, then stages and uploads three input files totaling about 4.8 MB. The first task runs the analysis, and the second task grades its results. Analysis output is saved under analysis-results/<task-id>/, along with the full agent trace as messages.json; judge output is saved in its judge/ subdirectory.

Adapting this for your analysis

To adapt this to your analysis, you can either:
  1. Replace PROMPT and JUDGE_PROMPT with your analysis prompt and rubric.
  2. Use this as a base for a batch analysis across many datasets.
If you choose to launch multiple tasks at once, you may hit the limits for your account. These will be reflected as 429 errors from either the Phylo API or internal tools used by the Biomni agent, such as tasks spawned on the HPC. If you encounter these errors, limit the number of tasks you start with the Phylo API.