Skip to content

BioThings / SmartAPI KPClient tool#277

Open
ahueb wants to merge 10 commits intosnap-stanford:mainfrom
andrewsu:biothings_tools
Open

BioThings / SmartAPI KPClient tool#277
ahueb wants to merge 10 commits intosnap-stanford:mainfrom
andrewsu:biothings_tools

Conversation

@ahueb
Copy link

@ahueb ahueb commented Jan 27, 2026

Summary

The Knowledge Provider (KP) tool provides unified access to BioThings Translator / SmartAPI-backed data sources through KPClient (biomni/tool/kp_tool.py).
This PR adds the KPClient tool so the agent can retrieve KG and provider-backed biomedical data (TRAPI + BioThings) through one interface.

Changes Made

Added biomni/tool/kp_tool.py containing the KPClient class and KP surface functions in biomni/tool/database.py and their descriptions in biomni/tool/tool_description/database.py:

  • ensure_fresh
  • list_kps
  • describe_kp
  • query_kp
  • batch_query_kp
  • scroll_kp

KP is selected when prompts request data from sources it covers (Reactome, STRING, DGIdb, DrugCentral, MyGene/MyVariant/MyChem/MyDisease, GO/HPO/Mondo/DOID/UBERON, ARAX/BTE/MolePro/SPOKE/COHD/mediKanren/RTX KG2).

Future improvements

Tool choice is LLM-mediated, a future improvement would be an execution-time guardrail that enforces at least one query_kp/batch_query_kp call whenever requested data is in KP-covered sources.

Testing

import sys

sys.path.append("../")

from biomni.agent import A1

agent = A1(llm="claude-sonnet-4-5-20250929")

# One prompt per data type
log = agent.go("please locate annotation data for gene ID 1017")
log = agent.go("please locate variant annotation data for rs7412")
log = agent.go("please locate pathway data for TP53")
log = agent.go("please locate protein interaction data for EGFR")
log = agent.go("please locate drug-target association data for imatinib")
log = agent.go("please locate disease-gene association data for Alzheimer's disease")
log = agent.go("please locate ontology mapping data for BRCA1")
log = agent.go("please locate multi-hop evidence connecting KRAS to colorectal cancer")

✅ Selection testing across the prompt set all passed

andrewsu and others added 7 commits January 23, 2026 11:15
Add new tool to query the MyGene.info database using the biothings-client
package. Supports querying by Entrez gene IDs to get annotations, or by
gene symbols to find gene IDs. Includes support for efficient batch queries.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ahueb ahueb marked this pull request as draft February 18, 2026 17:41
@ahueb ahueb changed the title Biothings tools [WIP] Biothings tools Feb 18, 2026
@ahueb ahueb changed the title [WIP] Biothings tools BioThings / SmartAPI KPClient tool Feb 22, 2026
@ahueb ahueb marked this pull request as ready for review February 22, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants