Construct a biomedical analysis agent with Biomni instruments and Amazon Bedrock AgentCore Gateway


This put up is co-authored with the Biomni group from Stanford.

Biomedical researchers spend roughly 90% of their time manually processing large volumes of scattered info. That is evidenced by Genentech’s challenge of processing 38 million biomedical publications in PubMed, public repositories just like the Human Protein Atlas, and their inside repository of a whole bunch of tens of millions of cells throughout a whole bunch of illnesses. There’s a fast proliferation of specialised databases and analytical instruments throughout completely different modalities together with genomics, proteomics, and pathology. Researchers should keep present with the massive panorama of instruments, leaving much less time for the hypothesis-driven work that drives breakthrough discoveries.

AI brokers powered by basis fashions supply a promising answer by autonomously planning, executing, and adapting complicated analysis duties. Stanford researchers constructed Biomni that exemplifies this potential. Biomni is a general-purpose biomedical AI agent that integrates 150 specialised instruments, 105 software program packages, and 59 databases to execute subtle analyses reminiscent of gene prioritization, drug repurposing, and uncommon illness analysis.

Nevertheless, deploying such brokers in manufacturing requires strong infrastructure able to dealing with computationally intensive workflows and a number of concurrent customers whereas sustaining safety and efficiency requirements. Amazon Bedrock AgentCore is a set of complete providers to deploy and function extremely succesful brokers utilizing any framework or mannequin, with enterprise-grade safety and scalability.

On this put up, we present you implement a analysis agent utilizing AgentCore with entry to over 30 specialised biomedical database instruments from Biomni, thereby accelerating scientific discovery whereas sustaining enterprise-grade safety and manufacturing scale. The code for this answer is offered within the open-source toolkit repository of starter brokers for all times sciences on Amazon Internet Companies (AWS). The step by step instruction helps you deploy your personal instruments and infrastructure, together with AgentCore parts, and examples.

Prototype-to-production complexity hole

Shifting from a neighborhood biomedical analysis prototype to a manufacturing system accessible by a number of analysis groups requires addressing complicated infrastructure challenges.

Agent deployment with enterprise safety

Enterprise safety challenges embrace OAuth-based authentication, safe software sharing via scalable gateways, complete observability for analysis audit trails, and automated scaling to deal with concurrent analysis workloads. Many promising prototypes fail to succeed in manufacturing due to the complexity of implementing these enterprise-grade necessities whereas sustaining the specialised area experience wanted for correct biomedical evaluation.

Session-aware analysis context administration

Biomedical analysis workflows usually span a number of conversations and require persistent reminiscence of earlier analyses, experimental parameters, and analysis preferences throughout prolonged analysis classes. Analysis brokers should preserve contextual consciousness of ongoing tasks, bear in mind particular protein targets, experimental circumstances, and analytical preferences. All that have to be completed whereas facilitating correct session isolation between completely different researchers and analysis tasks in a multi-tenant manufacturing surroundings.

Scalable software gateway

Implementing a reusable software gateway that may deal with concurrent requests from analysis agent, correct authentication, and constant efficiency turns into crucial at scale. The gateway should allow brokers to find and use instruments via safe endpoints, assist brokers discover the best instruments via contextual search capabilities, and handle each inbound authentication (verifying agent identification) and outbound authentication (connecting to exterior biomedical databases) in a unified service. With out this structure, analysis groups face authentication complexity and reliability points that forestall efficient scaling.

Answer overview

We use Strands Agents, an open supply agent framework, to construct a analysis agent with native software implementation for PubMed biomedical literature search. We prolonged the agent’s capabilities by integrating Biomni database instruments, offering entry to over 30 specialised biomedical databases.

The general structure is proven within the following diagram.

Architecture diagram of a research agent with Biomni Gateway

The AgentCore Gateway service centralizes Biomni database instruments as safer, reusable endpoints with semantic search capabilities. AgentCore Reminiscence service maintains contextual consciousness throughout analysis classes utilizing specialised methods for analysis context. Safety is dealt with by AgentCore Id service, which manages authentication for each customers and gear entry management. Deployment is streamlined with the AgentCore Runtime service, offering scalable, managed deployment with session isolation. Lastly, the AgentCore Observability service allows complete monitoring and auditing of analysis workflows which might be crucial for scientific reproducibility.

Step 1 – Creating instruments such because the Biomni database instruments utilizing AgentCore Gateway

In real-world use instances, we have to join brokers to completely different information sources. Every agent may duplicate the identical instruments, resulting in intensive code, inconsistent conduct, and upkeep nightmares. AgentCore Gateway service streamlines this course of by centralizing instruments into reusable, safe endpoints that brokers can entry. Mixed with the AgentCore Id service for authentication, AgentCore Gateway creates an enterprise-grade software sharing infrastructure. To offer extra context to the agent with reusable instruments, we offered entry to over 30 specialised public database APIs via the Biomni instruments registered on the gateway. The gateway exposes Biomni’s database instruments via the Model Context Protocol (MCP), permitting the analysis agent to find and invoke these instruments alongside native instruments like PubMed. It handles authentication, fee limiting, and error dealing with, offering a seamless analysis expertise.

def create_gateway(gateway_name: str, api_spec: listing) -> dict:
    # JWT authentication with Cognito
    auth_config = {
        "customJWTAuthorizer": {
            "allowedClients": [
                get_ssm_parameter("/app/researchapp/agentcore/machine_client_id")
            ],
            "discoveryUrl": 
                get_ssm_parameter("/app/researchapp/agentcore/cognito_discovery_url"),
        }
    }
    
    # Allow semantic seek for BioImm instruments
    search_config = {"hcp": {"searchType": "SEMANTIC"}}
    
    # Create the gateway
    gateway = bedrock_agent_client.create_gateway(
        identify=gateway_name,
        collectionexecution_role_arn,
        protocolType="MCP",
        authorizerType="CUSTOM_JWT",
        authorizerConfiguration=auth_config,
        protocolConfiguration=search_config,
        description="My App Template AgentCore Gateway",
    )
 
       
We use an AWS Lambda operate to host the Biomni integration code. The Lambda operate is mechanically configured as an MCP goal within the AgentCore Gateway. The Lambda operate exposes its out there instruments via the API specification ( api_spec.json).
# Gateway Goal Configuration
lambda_target_config = {
    "mcp": {
        "lambda": {
            "lambdaArn": get_ssm_parameter("/app/researchapp/agentcore/lambda_arn"),
            "toolSchema": {"inlinePayload": api_spec},
        }
    }
}

# Create the goal
create_target_response = gateway_client.create_gateway_target(
    gatewayIdentifier=gateway_id,
    identify="LambdaUsingSDK",
    description="Lambda Goal utilizing SDK",
    targetConfiguration=lambda_target_config,
    credentialProviderConfigurations=[{
        "credentialProviderType": "GATEWAY_IAM_ROLE"
    }],
)

The complete listing of Biomni database instruments included on the gateway are listed within the following desk:

Group Instrument Description
Protein and construction databases UniProt Question the UniProt REST API for complete protein sequence and purposeful info
AlphaFold Question the AlphaFold Database API for AI-predicted protein construction predictions
InterPro Question the InterPro REST API for protein domains, households, and purposeful websites
PDB (Protein Information Financial institution) Question the RCSB PDB database for experimentally decided protein buildings
STRING Question the STRING protein interplay database for protein-protein interplay networks
EMDB (Electron Microscopy Information Financial institution) Question for 3D macromolecular buildings decided by electron microscopy
Genomics and variants ClinVar Question NCBI's ClinVar database for clinically related genetic variants and their interpretations
dbSNP Question the NCBI dbSNP database for single nucleotide polymorphisms and genetic variations
gnomAD Question gnomAD for population-scale genetic variant frequencies and annotations
Ensembl Question the Ensembl REST API for genome annotations, gene info, and comparative genomics
UCSC Genome Browser Question the UCSC Genome Browser API for genomic information and annotations
Expression and omics GEO (Gene Expression Omnibus) Question NCBI's GEO for RNA-seq, microarray, and different gene expression datasets
PRIDE Question the PRIDE database for proteomics identifications and mass spectrometry information
Reactome Question the Reactome database for organic pathways and molecular interactions
Medical and drug information cBioPortal Question the cBioPortal REST API for most cancers genomics information and medical info
ClinicalTrials.gov Question ClinicalTrials.gov API for details about medical research and trials
OpenFDA Question the OpenFDA API for FDA drug, gadget, and meals security information
GtoPdb (Information to PHARMACOLOGY) Question the Information to PHARMACOLOGY database for drug targets and pharmacological information
Illness and phenotype OpenTargets Question the OpenTargets Platform API for disease-target associations and drug discovery information
Monarch Initiative Question the Monarch Initiative API for phenotype and illness info throughout species
GWAS Catalog Question the GWAS Catalog API for genome-wide affiliation research outcomes
RegulomeDB Question the RegulomeDB database for regulatory variant annotations and purposeful predictions
Specialised databases JASPAR Question the JASPAR REST API for transcription issue binding web site profiles and motifs
WoRMS (World Register of Marine Species) Question the WoRMS REST API for marine species taxonomic info
Paleobiology Database (PBDB) Question the PBDB API for fossil incidence and taxonomic information
MPD (Mouse Phenome Database) Question the Mouse Phenome Database for mouse pressure phenotype information
Synapse Question Synapse REST API for biomedical datasets and collaborative analysis information

The next are examples of how particular person instruments get triggered via the MCP from our take a look at suite:

# Protein and Construction Evaluation
"Use uniprot software to seek out details about human insulin protein"
# → Triggers uniprot MCP software with protein question parameters
"Use alphafold software for construction predictions for uniprot_id P01308"
# → Triggers alphafold MCP software for 3D construction prediction
"Use pdb software to seek out protein buildings for insulin"
# → Triggers pdb MCP software for crystallographic buildings
# Genetic Variation Evaluation  
"Use clinvar software to seek out pathogenic variants in BRCA1 gene"
# → Triggers clinvar MCP software with gene variant parameters
"Use gnomad software to seek out inhabitants frequencies for BRCA2 variants"
# → Triggers gnomad MCP software for inhabitants genetics information

Because the software assortment grows, the agent can use built-in semantic search capabilities to find and choose instruments primarily based on the duty context. This improves agent efficiency and lowering growth complexity at scale. For instance, the consumer asks, “inform me about HER2 variant rs1136201.” As a substitute of itemizing all 30 or extra instruments from the gateway again to the agent, semantic search returns ‘n’ most related instruments. For instance, Ensembl, Gwas catalog, ClinVar, and Dbsnp to the agent. The agent now makes use of a smaller subset of instruments as enter to the mannequin to return a extra environment friendly and sooner response.

The next graphic illustrates utilizing AgentCore Gateway for software search.

AgentCore Gateway tool search

Now you can take a look at your deployed AgentCore gateway utilizing the next take a look at scripts and evaluate how semantic search narrows down the listing of related instruments primarily based on the search question.

uv run assessments/test_gateway.py --prompt "What instruments can be found?"
uv run assessments/test_gateway.py --prompt "Discover details about human insulin protein" --use-search

Step 2- Strands analysis agent with a neighborhood software

The next code snippet exhibits mannequin initialization, implementing the PubMed native software that’s declared utilizing the Strands @software decorator. We’ve carried out the PubMed software in research_tools.py that calls PubMed APIs to allow biomedical literature search capabilities throughout the agent's execution context.

from agent.agent_config.instruments.PubMed import PubMed

@software(
    identify="Query_pubmed",
    description=(
        "Question PubMed for related biomedical literature primarily based on the consumer's question. "
        "This software searches PubMed abstracts and returns related research with "
        "titles, hyperlinks, and summaries."
    ),
)
def query_pubmed(question: str) -> str:
    """
    Question PubMed for related biomedical literature primarily based on the consumer's question.
    
    This software searches PubMed abstracts and returns related research with 
    titles, hyperlinks, and summaries.
    
    Args:
        question: The search question for PubMed literature
        
    Returns:
        str: Formatted outcomes from PubMed search
    """
    pubmed = PubMed()
    
    print(f"nPubMed Question: {question}n")
    end result = pubmed.run(question)
    print(f"nPubMed Outcomes: {end result}n")
    
    return end result

class ResearchAgent:
    def __init__(
        self,
        bearer_token: str,
        memory_hook: MemoryHook = None,
        session_manager: AgentCoreMemorySessionManager = None,
        bedrock_model_id: str = "us.anthropic.claude-sonnet-4-20250514-v1.0",
        #bedrock_model_id: str = "openai.gpt-oss-120b-1.0",  # Various
        system_prompt: str = None,
        instruments: Checklist[callable] = None,
    ):
        
        self.model_id = bedrock_model_id
        # For Anthropic Sonnet 4 interleaved considering
        self.mannequin = BedrockModel(
            model_id=self.model_id,
            additional_request_fields={
                "anthropic_beta": ["interleaved-thinking-2025-05-14"],
                "considering": {"kind": "enabled", "budget_tokens": 8000},
            },
        )
        
        self.system_prompt = (
            system_prompt
            if system_prompt
            else """
You're a **Complete Biomedical Analysis Agent** specialised in conducting 
systematic literature critiques and multi-database analyses to reply complicated biomedical analysis 
questions. Your main mission is to synthesize proof from each revealed literature 
(PubMed) and real-time database queries to offer complete, evidence-based insights for 
pharmaceutical analysis, drug discovery, and medical decision-making.

Your core capabilities embrace literature evaluation and extracting information from 30+ specialised 
biomedical databases** via the Bioimm gateway, enabling complete information evaluation. The 
database software classes embrace genomics and genetics, protein construction and performance, pathways 
and system biology, medical and pharmacological information, expression and omics information and different 
specialised databases.
"""
        )
  • As well as, we carried out citations that use a structured system immediate to implement numbered in-text citations [1], [2], [3] with standardized reference codecs for each educational literature and database queries, marking positive each information supply is correctly attributed. This enables researchers to rapidly entry and reference the scientific literature that helps their biomedical analysis queries and findings.
"""
<citation_requirements>
- ALWAYS use numbered in-text citations [1], [2], [3], and many others. when referencing any information supply
- Present a numbered "References" part on the finish with full supply particulars
- For educational literature: format as "1. Creator et al. Title. Journal. Yr. ID: [PMID/DOI], out there at: [URL]"
- For database sources: format as "1. Database Identify (Instrument: tool_name), Question: [query_description], Retrieved: [current_date]"
- Use numbered in-text citations all through your response to assist all claims and information factors
- Every software question and every literature supply have to be cited with its personal distinctive reference quantity
- When instruments return educational papers, cite them utilizing the educational format with full bibliographic particulars
- Construction: Format every reference on a separate line with correct numbering - NO bullet factors
- Current the References part as a clear numbered listing, not a complicated paragraph
- Preserve sequential numbering throughout all reference sorts in a single "References" part
</citation_requirements>
"""

Now you can take a look at your agent domestically:

uv run assessments/test_agent_locally.py --prompt "Discover details about human insulin protein"
uv run assessments/test_agent_locally.py --prompt "Discover details about human insulin protein" --use-search

Step 3 - Add Persistent Reminiscence for contextual analysis help

The analysis agent implements the AgentCore Memory service with three methods: semantic for factual analysis context, user_preference for analysis methodologies, and abstract for session continuity. The AgentCore Reminiscence session supervisor is built-in with Strands session management and retrieves related context earlier than queries and save interactions after responses. This allows the agent to recollect analysis preferences, ongoing tasks, and area experience throughout classes with out handbook context re-establishment.

# Take a look at reminiscence performance with analysis conversations

python assessments/test_memory.py load-conversation<br />python assessments/test_memory.py load-prompt "My most popular response format is detailed explanations"

Step 4 - Deploy with AgentCore Runtime

To deploy our agent, we use AgentCore Runtime to configure and launch the analysis agent as a managed service. The deployment course of configures the runtime with the agent's primary entrypoint (agent/main.py), assigns an IAM execution function for AWS service entry, and helps each OAuth and IAM authentication modes. After deployment, the runtime turns into a scalable, serverless agent that may be invoked utilizing API calls. The agent mechanically handles session administration, reminiscence persistence, and gear orchestration whereas offering safe entry to the Biomni gateway and native analysis instruments.

agentcore configure --entrypoint agent/primary.py -er arn:aws:iam::&lt;Account-Id&gt;:function/&lt;Position&gt; --name researchapp&lt;AgentName&gt;

For extra details about deploying with AgentCore Runtime, see Get started with AgentCore Runtime within the Amazon Bedrock AgentCore Developer Information.

Brokers in motion 

The next are three consultant analysis eventualities that showcase the agent's capabilities throughout completely different domains: drug mechanism evaluation, genetic variant investigation, and pathway exploration. For every question, the agent autonomously determines which mixture of instruments to make use of, formulates applicable sub-queries, analyzes the returned information, and synthesizes a complete analysis report with correct citations. The accompanying demo video exhibits the entire agent workflow, together with instruments choice, reasoning, and response era.

  1. Conduct a complete evaluation of trastuzumab (Herceptin) mechanism of motion and resistance mechanisms you’ll want:
    1. HER2 protein construction and binding websites
    2. Downstream signaling pathways affected
    3. Identified resistance mechanisms from medical information
    4. Present medical trials investigating mixture therapies
    5. Biomarkers for therapy response predictionQuery related databases to offer a complete analysis report.
  2. Analyze the medical significance of BRCA1 variants in breast most cancers threat and therapy response. Examine:
    1. Inhabitants frequencies of pathogenic BRCA1 variants
    2. Medical significance and pathogenicity classifications
    3. Related most cancers dangers and penetrance estimates
    4. Remedy implications (PARP inhibitors, platinum brokers)
    5. Present medical trials for BRCA1-positive sufferers
      Use a number of databases to offer complete proof

The next video is an illustration of a biomedical analysis agent:

Scalability and observability

One of the vital crucial challenges in deploying subtle AI brokers is ensuring they scale reliably whereas sustaining complete visibility into their operations. Biomedical analysis workflows are inherently unpredictable—a single genomic evaluation may course of hundreds of recordsdata, whereas a literature assessment may span tens of millions of publications. Conventional infrastructure struggles with these dynamic workloads, significantly when dealing with delicate analysis information that requires strict isolation between completely different analysis tasks.On this deployment, we use Amazon Bedrock AgentCore Observability to visualise every step within the agent workflow. You should utilize this service to examine an agent's execution path, audit intermediate outputs, and debug efficiency bottlenecks and failures. For biomedical analysis, this stage of transparency is not only useful—it is important for regulatory compliance and scientific reproducibility.

Classes, traces, and spans type a three-tiered hierarchical relationship within the observability framework. A session incorporates a number of traces, with every hint representing a discrete interplay throughout the broader context of the session. Every hint incorporates a number of spans that seize fine-grained operations. The next screenshot sneakers the utilization of 1 agent: Variety of classes, token utilization, and error fee in manufacturing

The next screenshot exhibits the brokers in manufacturing and their utilization (variety of Classes, variety of invocations)

The built-in dashboards present efficiency bottlenecks and determine why sure interactions may fail, enabling steady enchancment and lowering the imply time to detect (MTTD) and imply time to restore (MTTR). For biomedical functions the place failed analyses can delay crucial analysis timelines, this fast challenge decision functionality makes positive that analysis momentum is maintained.

Future course

Whereas this implementation focuses on solely a subset of instruments, the AgentCore Gateway structure is designed for extensibility. Analysis groups can seamlessly add new instruments with out requiring code modifications by utilizing the MCP protocol. Newly registered instruments are mechanically discoverable by brokers permitting your analysis infrastructure to evolve alongside the quickly altering software units.

For computational evaluation that requires code execution, the AgentCore Code Interpreter service may be built-in into the analysis workflow. With AgentCore Code Interpreter the analysis agent can retrieve information and execute Python-based evaluation utilizing domain-specific libraries like BioPython, scikit-learn, or customized genomics packages.

Future extensions may assist a number of analysis brokers to collaborate on complicated tasks, with specialised brokers for literature assessment, experimental design, information evaluation, and end result interpretation working collectively via multi-agent collaboration. Organizations also can develop specialised analysis brokers tailor-made to particular therapeutic areas, illness domains, or analysis methodologies that share the identical enterprise infrastructure and gear gateway.

Wanting forward with Biomni

“Biomni in the present day is already helpful for tutorial analysis and open exploration. However to allow actual discovery—like advancing drug growth—we have to transfer past prototypes and make the system enterprise-ready. Embedding Biomni into the workflows of biotech and pharma is important to show analysis potential into tangible impression.

That’s why we're excited to combine the open-source surroundings with Amazon Bedrock AgentCore, bridging the hole from analysis to manufacturing. Wanting forward, we’re additionally enthusiastic about extending these capabilities with the Biomni A1 agent structure and the Biomni-R0 mannequin, which can unlock much more subtle biomedical reasoning and evaluation. On the similar time, Biomni will stay a thriving open-source surroundings, the place researchers and business groups alike can contribute instruments, share workflows, and push the frontier of biomedical AI along with AgentCore.”

Conclusion

This implementation demonstrates how organizations can use Amazon Bedrock AgentCore to rework biomedical analysis prototypes into production-ready programs. By integrating Biomni's complete assortment of over 150 specialised instruments via the AgentCore Gateway service, we illustrate how groups can create enterprise-grade software sharing infrastructure that scales throughout a number of analysis domains.The mixture of Biomni's biomedical instruments with the enterprise infrastructure of Bedrock AgentCore organizations can construct analysis brokers that preserve scientific rigor whereas assembly manufacturing necessities for safety, scalability, and observability. Biomni's various software assortment—spanning genomics, proteomics, and medical databases—exemplifies how specialised analysis capabilities may be centralized and shared throughout analysis groups via a safe gateway structure.

To start constructing your personal biomedical analysis agent with Biomni instruments, discover the implementation by visiting our GitHub repository for the entire code and documentation. You possibly can comply with the step-by-step implementation information to arrange your analysis agent with native instruments, gateway integration, and Bedorck AgentCore deployment. As your wants evolve, you may prolong the system along with your group's proprietary databases and analytical instruments. We encourage you to affix the rising surroundings of life sciences AI brokers and instruments by sharing your extensions and enhancements.


Concerning the authors

Hasan Poonawala is a Senior AI/ML Options Architect at AWS, working with Healthcare and Life Sciences clients. Hasan helps design, deploy and scale Generative AI and Machine studying functions on AWS. He has over 15 years of mixed work expertise in machine studying, software program growth and information science on the cloud. In his spare time, Hasan likes to discover nature and spend time with family and friends.

pidemal Pierre de Malliard is a Senior AI/ML Options Architect at Amazon Internet Companies and helps clients within the Healthcare and Life Sciences Trade. He's presently primarily based in New York Metropolis.

Necibe Ahat is a Senior AI/ML Specialist Options Architect at AWS, working with Healthcare and Life Sciences clients. Necibe helps clients to advance their generative AI and machine studying journey. She has a background in pc science with 15 years of business expertise serving to clients ideate, design, construct and deploy options at scale. She is a passionate inclusion and variety advocate.

Kexin Huang is a final-year PhD scholar in Pc Science at Stanford College, suggested by Prof. Jure Leskovec. His analysis applies AI to allow interpretable and deployable biomedical discoveries, addressing core challenges in multi-modal modeling, uncertainty, and reasoning. His work has appeared in Nature Medication, Nature Biotechnology, Nature Chemical Biology, Nature Biomedical Engineering and high ML venues (NeurIPS, ICML, ICLR), incomes six finest paper awards. His analysis has been highlighted by Forbes, WIRED, and MIT Expertise Overview, and he has contributed to AI analysis at Genentech, GSK, Pfizer, IQVIA, Flatiron Well being, Dana-Farber, and Rockefeller College.

Leave a Reply

Your email address will not be published. Required fields are marked *