Agentic RAG

AI-agents
AI
analysis
Author

Aneesh Sathe

Published

April 30, 2024

Helping AI agents answer questions in your narrow domain

Table of Contents 1. Setup: Import Libraries and API endpoint 2. Load path to documents 3. Create agents 4. Ask AI question based on updated info 5. AI Output to question about LDT ruling

1. Import libraries and setup API Endpoint

back to top

import json
import os
from pathlib import Path

import chromadb
import autogen
from autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgent
from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
from autogen import config_list_from_json
# A local work_dir in case you want to execute code and store local files
work_dir = "work_dir"
docs_dir = "rag_docs/"
docs_path = Path(work_dir, docs_dir)

config_list_path = "../json_configs/OAI_CONFIG_LIST.json"
config_list = config_list_from_json(env_or_file=config_list_path)
llm_config = {"config_list": config_list, "cache_seed": None}

2. Create list of documents to be used by the AI agents

back to top

# more URLS or pdfs can be added here as needed
docs_list = [ 
     "https://www.fda.gov/news-events/press-announcements/fda-takes-action-aimed-helping-ensure-safety-and-effectiveness-laboratory-developed-tests",
]

3. Construct agents to use the documents

back to top

# 1. create an RetrieveAssistantAgent instance named "assistant"
assistant = RetrieveAssistantAgent(
    name="assistant",
    system_message="You are a helpful assistant.",
    llm_config={
        "timeout": 600,
        "cache_seed": 42,
        "config_list": config_list,
    },
)

# 2. create the RetrieveUserProxyAgent instance named "ragproxyagent"
ragproxyagent = RetrieveUserProxyAgent(
    name="ragproxyagent",
    human_input_mode="NEVER",
    max_consecutive_auto_reply=3,
    retrieve_config={
        "task": "code",
        "docs_path": docs_list,
        "chunk_token_size": 2000,
        "model": config_list[0]["model"],
        "vector_db": "chroma",  
        "overwrite": True,  # set to True if you want to overwrite an existing collection
    },
    code_execution_config=False,  # set to False if you don't want to execute the code
)

4. Ask Question to the agent about the new FDA ruling and it’s effect on a hypothetical startup

back to top

# reset the assistant. Always reset the assistant before starting a new conversation.
assistant.reset()

code_problem = "I am a AI for healthcare product startup and have active LDTS. How does the new FDA ruling affect LDTs and the startup?"
chat_result = ragproxyagent.initiate_chat(
    assistant, message=ragproxyagent.message_generator, problem=code_problem
) 
Number of requested results 20 is greater than number of elements in index 1, updating n_results = 1
VectorDB returns doc_ids:  [['216d280b']]
Adding content of doc 216d280b to context.
ragproxyagent (to assistant):

You're a retrieve augmented coding assistant. You answer user's questions based on your own knowledge and the
context provided by the user.
If you can't answer the question with or without the current context, you should reply exactly `UPDATE CONTEXT`.
For code generation, you must obey the following rules:
Rule 1. You MUST NOT install any packages because all the packages needed are already installed.
Rule 2. You must follow the formats below to write your code:
```language
# your code
```

User's question is: I am a AI for healthcare product startup and have active LDTS. How does the new FDA ruling affect LDTs and the startup?

Context is: # FDA Takes Action Aimed at Helping to Ensure the Safety and Effectiveness of Laboratory Developed Tests | FDA

FDA Takes Action Aimed at Helping to Ensure the Safety and Effectiveness of Laboratory Developed Tests | FDA

* [Skip to main content](#main-content)
* [Skip to FDA Search](#search-form)
* [Skip to in this section menu](#section-nav)
* [Skip to footer links](#footer-heading)

 

 

![U.S. flag](/themes/custom/preview/assets/images/US_Flag.png)
An official website of the United States government
Here’s how you know

![Dot gov](/themes/custom/preview/assets/images/icon-dot-gov.svg)

**The .gov means it’s official.**  
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you're on a federal government site.

![SSL](/themes/custom/preview/assets/images/icon-https.svg)

**The site is secure.**  
 The **https://** ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

[U.S. Food and Drug Administration
=================================](/ "FDA Homepage")

* Search
* [Menu](#primary-nav)

Search FDA

Submit search

 

Featured
--------

* [Report a Product Problem](https://www.safetyreporting.hhs.gov/smarthub#/ "Report a Problem with an FDA Regulated Product")
* [Contact FDA](/about-fda/contact-fda)
* [FDA Guidance Documents](/regulatory-information/search-fda-guidance-documents)
* [Recalls, Market Withdrawals and Safety Alerts](/safety/recalls-market-withdrawals-safety-alerts)
* [Press Announcements](/news-events/newsroom/press-announcements)
* [Warning Letters](/inspections-compliance-enforcement-and-criminal-investigations/compliance-actions-and-activities/warning-letters)
* [Advisory Committees](/advisory-committees)
* [En Español](/about-fda/en-espanol)

Products
--------

* [Food](/food)
* [Drugs](/drugs)
* [Medical Devices](/medical-devices)
* [Radiation-Emitting Products](/radiation-emitting-products)
* [Vaccines, Blood, and Biologics](/vaccines-blood-biologics)
* [Animal and Veterinary](/animal-veterinary)
* [Cosmetics](/cosmetics)
* [Tobacco Products](/tobacco-products)

Topics
------

* [About FDA](/about-fda)
* [Combination Products](/combination-products)
* [Regulatory Information](/regulatory-information)
* [Safety](/safety)
* [Emergency Preparedness](/emergency-preparedness-and-response)
* [International Programs](/international-programs)
* [News and Events](/news-events)
* [Training and Continuing Education](/training-and-continuing-education)
* [Inspections and Compliance](/inspections-compliance-enforcement-and-criminal-investigations)
* [Science and Research](/science-research)

Information For
---------------

* [Consumers](/consumers)
* [Patients](/patients)
* [Industry](/industry)
* [Health Professionals](/health-professionals)
* [Federal, State and Local Officials](/federal-state-local-tribal-and-territorial-officials)

[In this section:

 Press Announcements](#section-nav)

* [Press Announcements](/news-events/fda-newsroom/press-announcements "Press Announcements")

1. [Home](/)
2. [News & Events](/news-events)
3. [FDA Newsroom](/news-events/fda-newsroom)
4. [Press Announcements](/news-events/fda-newsroom/press-announcements)
5. FDA Takes Action Aimed at Helping to Ensure the Safety and Effectiveness of Laboratory Developed Tests

1. [Press Announcements](/news-events/fda-newsroom/press-announcements "Press Announcements")

FDA News Release

FDA Takes Action Aimed at Helping to Ensure the Safety and Effectiveness of Laboratory Developed Tests
======================================================================================================

* [Share](https://www.facebook.com/sharer/sharer.php?u=https://www.fda.gov%2Fnews-events%2Fpress-announcements%2Ffda-takes-action-aimed-helping-ensure-safety-and-effectiveness-laboratory-developed-tests)
* [Post](https://x.com/intent/tweet/?text=FDA%20Takes%20Action%20Aimed%20at%20Helping%20to%20Ensure%20the%20Safety%20and%20Effectiveness%20of%20Laboratory%20Developed%20Tests&url=https://www.fda.gov%2Fnews-events%2Fpress-announcements%2Ffda-takes-action-aimed-helping-ensure-safety-and-effectiveness-laboratory-developed-tests)
* [Linkedin](https://www.linkedin.com/shareArticle?mini=true&url=https://www.fda.gov%2Fnews-events%2Fpress-announcements%2Ffda-takes-action-aimed-helping-ensure-safety-and-effectiveness-laboratory-developed-tests&title=FDA%20Takes%20Action%20Aimed%20at%20Helping%20to%20Ensure%20the%20Safety%20and%20Effectiveness%20of%20Laboratory%20Developed%20Tests&source=FDA)
* [Email](mailto:?subject=FDA%20Takes%20Action%20Aimed%20at%20Helping%20to%20Ensure%20the%20Safety%20and%20Effectiveness%20of%20Laboratory%20Developed%20Tests&body=https://www.fda.gov%2Fnews-events%2Fpress-announcements%2Ffda-takes-action-aimed-helping-ensure-safety-and-effectiveness-laboratory-developed-tests)
* [Print](javascript:window.print(); "Print this page")

For Immediate Release:
April 29, 2024

[Español](https://www.fda.gov/news-events/press-announcements/la-fda-toma-medidas-destinadas-garantizar-la-inocuidad-y-eficacia-de-las-pruebas-efectuadas-en)

Today, the U.S. Food and Drug Administration took action aimed at helping to ensure the safety and effectiveness of laboratory developed tests, or LDTs, which are used in a growing number of health care decisions and about which concerns have been raised for many years. 

LDTs are in vitro diagnostic products (IVDs) that the FDA has described as intended for clinical use and designed, manufactured and used within a single clinical laboratory that meets certain regulatory requirements. IVDs can play an important role in health care; they are used in the collection, preparation and examination of specimens taken from the human body, such as blood, saliva or tissue. They can be used to measure or detect substances or analytes, such as proteins, glucose, cholesterol or DNA, to provide information about a patient’s health, including to identify, monitor or determine treatment for diseases and conditions. 

The FDA announced a final rule today amending the FDA’s regulations to make explicit that IVDs are devices under the Federal Food, Drug, and Cosmetic Act (FD&C Act) including when the manufacturer of the IVD is a laboratory. Along with this amendment, the FDA issued a policy to phase out, over the course of four years, its general enforcement discretion approach for LDTs. The agency also issued targeted enforcement discretion policies for certain categories of IVDs manufactured by laboratories.

**“LDTs are being used more widely than ever before – for use in newborn screening, to help predict a person’s risk of cancer, or aid in diagnosing heart disease and Alzheimer’s. The agency cannot stand by while Americans continue to rely on results of these tests without assurance that they work,” said FDA Commissioner Robert M. Califf, M.D. “The final rule announced today aims to provide crucial oversight of these tests to help ensure that important health care decisions are made based on test results that patients and health care providers can trust.”**

Although historically the FDA has generally exercised enforcement discretion for most LDTs, meaning that the agency generally has not enforced applicable requirements with respect to most LDTs, the risks associated with most modern LDTs are much greater than the risks associated with LDTs used when the FDA’s enforcement discretion approach was adopted many decades ago. At that time, many LDTs were lower risk, small volume and used for specialized needs of a local patient population. Now, many LDTs are used more widely, for a larger and more diverse population, with large laboratories accepting specimens from across the country. LDTs also increasingly rely on high-tech instrumentation and software, are performed in large volumes and are used more frequently to help guide critical health care decisions.

Moreover, there is a growing body of evidence that demonstrates that some IVDs offered as LDTs raise public health concerns; for example, they do not provide accurate test results or do not perform as well as FDA-authorized tests, including from published studies in the scientific literature, the FDA’s own experience in reviewing IVDs offered as LDTs, news articles and class-action lawsuits.

The FDA is aware of numerous examples of potentially inaccurate, unsafe, ineffective or poor quality IVDs offered as LDTs that caused or may have caused patient harm, including tests used to select cancer treatment, aid in the diagnosis of COVID-19, aid in the management of patients with rare diseases and identify a patient’s risk of cancer. 

Without greater oversight of the safety and effectiveness of LDTs, patients may be more likely to initiate unnecessary treatment, or delay or forego proper treatment based on inaccurate test results or tests promoted with false or misleading claims. This could result in harm, including worsening illness or death, as well as unnecessarily increase health care costs. 

Increased compliance with device requirements under the FD&C Act (such as premarket review, quality system (QS) requirements, adverse event reporting, establishment registration and device listing, labeling requirements and investigational use requirements) will put patients and health care providers in a better position to have confidence in IVDs regardless of where they are manufactured. 

With increased oversight, the FDA will also be able to help promote adequate representation in validation studies, as well as transparency regarding potential differential performance and unknown performance in certain patient populations, which may ultimately help advance health equity.

**“Today’s action is a critical step toward helping to ensure the safety and effectiveness of LDTs, while also taking into account other public health considerations, including continued access to critical tests patients rely upon,” said Jeff Shuren, M.D., J.D., director of the FDA’s Center for Devices and Radiological Health. “Through targeted enforcement discretion policies for certain categories of tests manufactured by a laboratory, we expect patients and health care professionals will continue to have access to the tests they need while having greater confidence that the tests they rely on are accurate.”**

The phaseout of the FDA’s general enforcement discretion approach for LDTs over a period of four years will protect the public health by helping to assure the safety and effectiveness of these tests, while avoiding undue disruption to patient care. Better assuring the safety and effectiveness of LDTs may also foster test innovation and facilitate the collective efforts of the scientific and medical communities to identify promising technologies, new therapies or areas worthy of future research.

Importantly, the FDA considered the large volume of comments received on the notice of proposed rulemaking, and in light of that input, has adjusted the phaseout policy in a manner that better serves the public health. After this phaseout, the FDA generally will expect IVDs made by either a non-laboratory or laboratory to meet the same requirements, though certain IVDs manufactured by laboratories may fall within one of the agency’s targeted enforcement discretion policies. 

The FDA intends to exercise enforcement discretion with regard to premarket review and most quality system requirements for certain categories of IVDs, including but not limited to:

* Currently marketed IVDs offered as LDTs that were first marketed prior to the date of issuance of the final rule. This enforcement discretion policy is intended to address the risk that the perceived costs of compliance with such requirements could lead to the widespread loss of access to beneficial IVDs on which patients currently rely.
* LDTs manufactured and performed by a laboratory integrated within a health care system to meet an unmet need of patients receiving care within the same health care system when an FDA-authorized test is not available. This enforcement discretion policy is intended to help avoid patients being deprived of critically needed LDTs where certain risk mitigations exist that may help laboratories to identify any problems with their LDT and may help inform appropriate use and interpretation of such LDTs.

The FDA has also included additional enforcement discretion policies, such as for LDTs approved by the New York State’s Clinical Laboratory Evaluation Program (CLEP), as described in the preamble to the final rule, where that program’s review of analytical and clinical validity helps to mitigate the risk of harm from inaccurate and unreliable LDTs. 

### Draft Guidance Documents

The agency also issued two draft guidances today. One [provides the agency’s thinking](https://www.fda.gov/regulatory-information/search-fda-guidance-documents/enforcement-policy-certain-in-vitro-diagnostic-devices-immediate-public-health-response-absence) about an enforcement discretion policy for certain laboratories offering certain unauthorized IVDs for immediate response to an emergent situation, such as an outbreak of an infectious disease, in the absence of a declaration applicable to IVDs under section 564 of the FD&C Act. The other [provides insight](https://www.fda.gov/regulatory-information/search-fda-guidance-documents/consideration-enforcement-policies-tests-during-section-564-declared-emergency) into the FDA’s thinking about the factors the agency intends to consider when developing a policy regarding enforcement discretion for certain IVDs during a public health emergency declared under section 564 of the FD&C Act.

Related Information
-------------------

Related Information
* [Federal Register, Final Rule](https://www.federalregister.gov/public-inspection/2024-08935/medical-devices-laboratory-developed-tests)
* [FDA: Laboratory Developed Tests](https://www.fda.gov/medical-devices/in-vitro-diagnostics/laboratory-developed-tests)
* [FDA: LDT Frequently Asked Questions](https://www.fda.gov/medical-devices/laboratory-developed-tests/laboratory-developed-tests-frequently-asked-questions)

###

Boilerplate
The FDA, an agency within the U.S. Department of Health and Human Services, protects the public health by assuring the safety, effectiveness, and security of human and veterinary drugs, vaccines and other biological products for human use, and medical devices. The agency also is responsible for the safety and security of our nation’s food supply, cosmetics, dietary supplements, radiation-emitting electronic products, and for regulating tobacco products.

---

Inquiries
---------

Media:

 [James (Jim) McKinney](mailto:james.mckinney@fda.hhs.gov)

 240-328-7305
 

Consumer:
 888-INFO-FDA

  

 

* Content current as of:
----------------------

04/29/2024
* Regulated Product(s)
--------------------

    + Medical Devices
* Follow FDA
----------

    + [Follow @US\_FDA on X](https://x.com/US_FDA)
    + [Follow FDA on Facebook](https://www.facebook.com/FDA)
    + [Follow @FDAMedia on X](https://x.com/FDAMedia)

 

 [More Press Announcements](/news-events/newsroom/press-announcements)

* 

 

Footer Links
------------

* [FDA Archive](/about-fda/about-website/fdagov-archive)
* [About FDA](/about-fda)
* [Accessibility](/about-fda/about-website/internet-accessibility)

* [Visitor Information](/about-fda/visitor-information)
* [Website Policies / Privacy](/about-fda/about-website/website-policies)
* [No FEAR Act](/about-fda/jobs-and-training-fda/no-fear-act)
* [Vulnerability Disclosure Policy](https://www.hhs.gov/vulnerability-disclosure-policy/index.html)

* [FOIA](/regulatory-information/freedom-information "Freedom of Information Act")
* [HHS.gov](https://www.hhs.gov/ "Health and Human Services")
* [USA.gov](https://www.usa.gov/)

[Contact FDA](/about-fda/contact-fda)
[Follow FDA on Facebook](https://www.facebook.com/FDA "Follow FDA on Facebook")
[Follow FDA on X](https://x.com/US_FDA "Follow FDA on X")
[Follow FDA on Instagram](https://instagram.com/FDA "Follow FDA on Instagram")
  

[FDA Homepage](/ "FDA Homepage")

 
Contact Number
 1-888-INFO-FDA (1-888-463-6332)
 

Back to Top



--------------------------------------------------------------------------------
assistant (to ragproxyagent):

The new FDA ruling significantly affects Laboratory Developed Tests (LDTs) and startups operating within this domain. Here’s how:

1. **Increased Oversight**: The FDA has amended its regulations to clearly classify IVDs (In Vitro Diagnostics), including those manufactured within laboratories as LDTs, as medical devices under the Federal Food, Drug, and Cosmetic Act (FD&C Act). This creates a regulatory landscape where previously unenforced standards will now be actively governed.

2. **Phase-Out of Enforcement Discretion**: Historically, the FDA exercised enforcement discretion for most LDTs, not stringently enforcing certain regulatory requirements. This approach is changing. The new regulation introduces a four-year phase-out of this general enforcement discretion, moving towards strict adherence to device requirements such as premarket reviews, quality system requirements, and adverse event reporting.

3. **Targeted Enforcement Discretion Policies**: Despite the phase-out, the FDA aims to implement targeted enforcement discretion for certain categories of LDTs. This includes:
   - Currently marketed IVDs offered as LDTs prior to the new rule’s issuance.
   - LDTs produced by laboratories integrated within a healthcare system to meet specific unmet patient needs, provided no FDA-authorized test is available.

4. **Impact on Startup Operations**: Startups in the healthcare product domain will need to adjust their operations and development strategies to comply with the new regulatory requirements. This includes ensuring that new and existing tests meet the stricter regulations set by the FDA, which could involve significant investment in clinical validation and quality control.

5. **Opportunity for Innovation and Trust**: Stringent regulations can foster innovation, leading to the development of more reliable and effective tests. Also, with increased regulatory oversight, healthcare providers and patients may have greater confidence in the safety and efficacy of LDTs, potentially leading to greater market acceptance.

6. **Need for Strategic Adjustments**: Startups may need to reallocate resources to deal with these regulatory changes, including hiring regulatory affairs specialists, investing in additional clinical studies, and adapting marketing strategies.

7. **Enforcement Policies during Emergencies**: The FDA provided insights into enforcement discretion policies that might apply during public emergencies (like infectious disease outbreaks), which might be relevant for startups focusing on rapid test development for such situations.

Understanding and adapting to these changes is crucial for startups in the LDT space to ensure compliance and to leverage potential opportunities for innovation and market leadership under the new regulatory framework.

--------------------------------------------------------------------------------

5. AI output in easy to read format:

back to top

The new FDA ruling significantly affects Laboratory Developed Tests (LDTs) and startups operating within this domain. Here’s how:

  1. Increased Oversight: The FDA has amended its regulations to clearly classify IVDs (In Vitro Diagnostics), including those manufactured within laboratories as LDTs, as medical devices under the Federal Food, Drug, and Cosmetic Act (FD&C Act). This creates a regulatory landscape where previously unenforced standards will now be actively governed.

  2. Phase-Out of Enforcement Discretion: Historically, the FDA exercised enforcement discretion for most LDTs, not stringently enforcing certain regulatory requirements. This approach is changing. The new regulation introduces a four-year phase-out of this general enforcement discretion, moving towards strict adherence to device requirements such as premarket reviews, quality system requirements, and adverse event reporting.

  3. Targeted Enforcement Discretion Policies: Despite the phase-out, the FDA aims to implement targeted enforcement discretion for certain categories of LDTs. This includes:

    • Currently marketed IVDs offered as LDTs prior to the new rule’s issuance.
    • LDTs produced by laboratories integrated within a healthcare system to meet specific unmet patient needs, provided no FDA-authorized test is available.
  4. Impact on Startup Operations: Startups in the healthcare product domain will need to adjust their operations and development strategies to comply with the new regulatory requirements. This includes ensuring that new and existing tests meet the stricter regulations set by the FDA, which could involve significant investment in clinical validation and quality control.

  5. Opportunity for Innovation and Trust: Stringent regulations can foster innovation, leading to the development of more reliable and effective tests. Also, with increased regulatory oversight, healthcare providers and patients may have greater confidence in the safety and efficacy of LDTs, potentially leading to greater market acceptance.

  6. Need for Strategic Adjustments: Startups may need to reallocate resources to deal with these regulatory changes, including hiring regulatory affairs specialists, investing in additional clinical studies, and adapting marketing strategies.

  7. Enforcement Policies during Emergencies: The FDA provided insights into enforcement discretion policies that might apply during public emergencies (like infectious disease outbreaks), which might be relevant for startups focusing on rapid test development for such situations.

Understanding and adapting to these changes is crucial for startups in the LDT space to ensure compliance and to leverage potential opportunities for innovation and market leadership under the new regulatory framework.