diff --git a/REPORT_DRAFT.md b/REPORT_DRAFT.md
new file mode 100644
index 0000000000..426c645e6c
--- /dev/null
+++ b/REPORT_DRAFT.md
@@ -0,0 +1,88 @@
+# Artificial Intelligence in Healthcare 2020-2025
+A Comprehensive Analysis of Technological, Ethical, and Operational Trends
+
+## 1. Introduction
+
+### Scope and Methodology
+Over the past five years, artificial intelligence (AI) has shifted from pilot projects to enterprise-wide enablers of clinical excellence, administrative efficiency, and patient engagement. This report synthesizes findings from industry analyses, peer-reviewed research, and corporate trend outlooks published between 2022 and 2025 to chart the trajectory of AI adoption in healthcare. The discussion spans machine learning (ML), deep learning (DL), natural language processing (NLP), medical imaging, and ambient intelligence, while also interrogating the regulatory, ethical, and operational consequences of rapid innovation.
+
+The evidence base is drawn exclusively from the reference resources supplied: a 2025 health-tech trend overview, a 2025 employer-centric healthcare forecast, two scholarly reviews on medical-imaging AI, and a 2025 ethics commentary. Insights from these sources were triangulated to extract common drivers, recurring challenges, and emerging opportunities. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcarehttps://newsroom.cigna.com/top-health-care-trends-of-2025https://www.nature.com/articles/s41746-022-00592-yhttps://pmc.ncbi.nlm.nih.gov/articles/PMC10740686/https://www.alation.com/blog/ethics-of-ai-in-healthcare-privacy-bias-trust-2025/
+
+## 2. Advances in Machine Learning and Deep Learning
+
+### Evolving Algorithmic Landscape
+Since 2020, DL architectures—particularly convolutional neural networks (CNNs), transformers, and generative adversarial networks (GANs)—have dominated AI innovation in healthcare. These models now underpin applications ranging from tumor detection on MRIs to 3-D surgical planning, delivering faster inference and improved accuracy across diverse imaging modalities. https://pmc.ncbi.nlm.nih.gov/articles/PMC10740686/ Their maturation coincided with a growing emphasis on retrieval-augmented generation (RAG) and synthetic data pipelines that reinforce model generalizability while safeguarding patient privacy. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+### From Bench to Bedside
+Clinical translation, however, remains uneven. A 2022 review highlighted systemic issues—dataset bias, publication-driven incentives, and evaluation gaps—that limit real-world impact despite impressive benchmark scores. https://www.nature.com/articles/s41746-022-00592-y Health systems counter these pitfalls by collaborating with technology partners and instituting rigorous validation protocols that tether algorithmic performance to measurable patient outcomes and return on investment. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+## 3. AI-Powered Medical Imaging
+
+### Technical Progress
+The marriage of CNNs and emerging vision transformers (ViTs) has redefined image segmentation, anomaly detection, and resolution enhancement. GANs now generate synthetic CT, MRI, and PET scans that supplement limited datasets, boosting training efficiency and reducing over-fitting risks. https://pmc.ncbi.nlm.nih.gov/articles/PMC10740686/ These advances facilitate earlier disease detection and personalized treatment planning, expanding AI’s footprint from academic radiology suites to community hospitals.
+
+### Addressing Clinical Challenges
+Despite technical strides, the imaging domain grapples with biased training corpora and opaque model reporting, undermining clinician trust and equitable care. https://www.nature.com/articles/s41746-022-00592-y To mitigate these issues, developers are adopting larger, demographically diverse datasets and promoting transparent documentation practices that explicate decision boundaries and failure modes. Ethical frameworks that prioritize fairness and reproducibility are now integral to procurement and deployment decisions. https://www.alation.com/blog/ethics-of-ai-in-healthcare-privacy-bias-trust-2025/
+
+## 4. Natural Language Processing & Ambient Intelligence
+
+### Automating Clinical Documentation
+Large language models (LLMs) paired with ambient listening devices have begun to transcribe and structure patient–provider conversations in real time, slashing manual documentation burdens. Early adopters report measurable gains in clinician satisfaction and time reclaimed for direct patient care. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare Retrieval-augmented generation further enriches these transcripts with context from electronic health records (EHRs), increasing factual accuracy and auditability.
+
+### Conversational AI for Engagement
+Outside the exam room, generative AI chatbots personalize health-plan navigation and preventive-care nudges, mirroring the customer-centric experiences popularized by consumer technology firms. Employers cite these NLP-driven interfaces as pivotal to improving benefit utilization and containing costs. https://newsroom.cigna.com/top-health-care-trends-of-2025
+
+## 5. Operational Transformation and Patient Experience
+
+### Streamlining Workflows
+AI now orchestrates scheduling, prior authorization, and claims adjudication, delivering cost savings through reduced administrative overhead. Hospitals leverage predictive analytics to forecast patient census and allocate staffing dynamically, aligning resources with demand. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+### IoMT and Machine Vision on the Ward
+Computer-vision sensors integrated into the Internet of Medical Things (IoMT) detect unsafe patient movements, triggering proactive fall-prevention interventions. The resulting reduction in adverse events demonstrates AI’s capacity to extend clinical vigilance beyond human line-of-sight. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+## 6. Regulatory Landscape & Governance
+
+### Increasing Scrutiny and Standards
+Regulators are intensifying oversight of AI tools, mandating interoperability, audit trails, and evidence of clinical efficacy. U.S. and EU agencies alike are signaling that AI-enabled devices will face approval pathways comparable to traditional medical technologies. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+### Compliance Strategies
+Healthcare organizations respond by embedding governance committees, adopting international standards for data handling, and engaging multidisciplinary review boards. Balanced deployment models that retain human-in-the-loop supervision are favored to satisfy both legal requirements and public expectations. https://newsroom.cigna.com/top-health-care-trends-of-2025https://www.alation.com/blog/ethics-of-ai-in-healthcare-privacy-bias-trust-2025/
+
+## 7. Ethical Considerations: Privacy, Bias, and Trust
+
+### Data Protection & Security
+LLMs and analytics engines depend on vast troves of sensitive data, heightening exposure to cyber-attacks. Encryption, federated learning, and strict access controls are now table stakes for vendors hoping to gain market acceptance. https://www.alation.com/blog/ethics-of-ai-in-healthcare-privacy-bias-trust-2025/
+
+### Algorithmic Fairness
+Biases encoded in historical datasets can propagate inequities, disproportionately affecting marginalized populations. Continuous monitoring, inclusive data collection, and bias audits during the model-development lifecycle are emerging best practices to ensure equitable care delivery. https://www.alation.com/blog/ethics-of-ai-in-healthcare-privacy-bias-trust-2025/https://www.nature.com/articles/s41746-022-00592-y
+
+## 8. Emerging Research Frontiers
+
+### Retrieval-Augmented Generation & Synthetic Data
+RAG frameworks combine real-time database querying with generative text to improve accuracy and transparency, a feature increasingly prized in clinical decision support. Simultaneously, synthetically generated tabular and imaging data sets allow researchers to stress-test models without exposing personally identifiable information, accelerating innovation while upholding privacy norms. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+### Generative Models & Synthetic Imaging
+GAN-based pipelines now enhance image resolution, fill modality gaps, and create rare-disease exemplars, thereby democratizing access to high-quality training corpora. This synthetic augmentation is particularly valuable for low-resource settings and niche specialties with sparse data. https://pmc.ncbi.nlm.nih.gov/articles/PMC10740686/
+
+## 9. Case Studies
+
+### Ambient Listening for Documentation Relief
+A large U.S. health system deployed microphone-enabled LLM solutions in outpatient clinics, achieving a marked reduction in after-hours charting and elevating provider satisfaction scores. The initiative demonstrated how RAG-enhanced NLP could deliver structured notes that integrate seamlessly with EHR templates. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+### Vision-Based Fall Prevention
+A network of hospitals installed ceiling-mounted cameras coupled with ML algorithms to detect unsupervised bed-exits. Alerts routed to nursing stations cut in-room fall rates and associated costs, illustrating AI’s tangible impact on patient safety KPIs. https://healthtechmagazine.net/article/2025/01/overview-2025-ai-trends-healthcare
+
+### Transformer-Driven COVID-19 Screening
+During the pandemic’s peak, researchers fine-tuned vision transformers for lung-field segmentation on chest X-rays, enabling rapid triage in overcrowded emergency departments. The model’s high sensitivity underscored DL’s agility in responding to emergent public-health crises. https://pmc.ncbi.nlm.nih.gov/articles/PMC10740686/
+
+## 10. Recommendations and Conclusion
+
+### Strategic Roadmap for Stakeholders
+1. Invest in modular, interoperable data infrastructures that can support RAG, federated learning, and continuous monitoring pipelines.
+2. Formalize multidisciplinary AI governance bodies to align technical innovation with ethical imperatives and regulatory mandates.
+3. Prioritize equitable dataset curation and deploy bias-mitigation tooling throughout the model lifecycle to foster trust among diverse patient cohorts.
+4. Expand public-private partnerships to generate high-quality synthetic data and open benchmarks that accelerate safe innovation.
+
+### Concluding Thoughts
+AI has progressed from experimental adjunct to indispensable infrastructure in healthcare, offering unprecedented gains in diagnostic accuracy, operational efficiency, and patient engagement. Sustaining this momentum will require vigilant governance, rigorous validation, and a steadfast commitment to equity and transparency. By integrating technical excellence with ethical stewardship, the healthcare industry can fully realize AI’s promise to enhance outcomes and democratize access to high-quality care.
+
diff --git a/authors.yaml b/authors.yaml
index b4c790125f..2fe8c30765 100644
--- a/authors.yaml
+++ b/authors.yaml
@@ -2,6 +2,11 @@
# You can optionally customize how your information shows up cookbook.openai.com over here.
# If your information is not present here, it will be pulled from your GitHub profile.
+
+moustafa-openai:
+ name: "Moustafa Elhadary"
+ website: "https://www.linkedin.com/in/moustafaelhadary/"
+ avatar: "https://avatars.githubusercontent.com/u/198829901?v=4"
rajpathak-openai:
name: "Raj Pathak"
website: "https://www.linkedin.com/in/rajpathakopenai/"
diff --git a/examples/agents_sdk/AI_Research_Assistant_Cookbook.ipynb b/examples/agents_sdk/AI_Research_Assistant_Cookbook.ipynb
new file mode 100644
index 0000000000..1c6cec8fb3
--- /dev/null
+++ b/examples/agents_sdk/AI_Research_Assistant_Cookbook.ipynb
@@ -0,0 +1,561 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "85b66af9",
+ "metadata": {},
+ "source": [
+ "# Build a **Multi‑Agent AI Research Assistant** with the OpenAI Agents SDK & Responses API\n",
+ "\n",
+ "This notebook provides a reference patterns for implementing a multi‑agent AI Research Assistant that can plan, search, curate, and draft high‑quality reports with citations.\n",
+ "\n",
+ "While the Deep Research feature is available in ChatGPT, however, individual and companies may want to implement their own API based solution for a more fine grained control over the output.\n",
+ "\n",
+ "With support for Agents, and built-in tools such as Code Interpreter, Web Search, and File Search, - Responses API makes building your own Research Assistant fast and easy. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0dcd3942",
+ "metadata": {},
+ "source": [
+ "## Table of Contents\n",
+ "1. [Overview](#overview)\n",
+ "2. [Solution Workflow](#workflow)\n",
+ "3. [High‑Level Architecture](#architecture)\n",
+ "4. [Agent Definitions (Pseudo Code)](#agents)\n",
+ " * Research Planning Agent\n",
+ " * Web Search Agent\n",
+ " * Knowledge Assistant Agent\n",
+ " * Report Creation Agent\n",
+ " * Data Analysis Agent (optional)\n",
+ " * Image‑Gen Agent (optional)\n",
+ "5. [Guardrails & Best Practices](#best-practices)\n",
+ "6. [Risks & Mitigation](#risks)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a32e358e",
+ "metadata": {},
+ "source": [
+ "### 1 — Overview \n",
+ "The AI Research Assistant helps drives better research quality and faster turnaround for knowledge content.\n",
+ "\n",
+ "1. **Performs autonomous Internet research** to gather the most recent sources.\n",
+ "2. **Incorporates internal data sources** such as a Company's proprietery knowledge sources. \n",
+ "3. **Reduces analyst effort from days to minutes** by automating search, curation and first‑draft writing.\n",
+ "4. **Produces draft reports with citations** and built‑in hallucination detection."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "33cb6ce3",
+ "metadata": {},
+ "source": [
+ "### 2 — Solution Workflow \n",
+ "The typical workflow consists of five orchestrated steps: \n",
+ "\n",
+ "| Step | Purpose | Model |\n",
+ "|------|---------|-------|\n",
+ "| **Query Expansion** | Draft multi‑facet prompts / hypotheses | `o4-mini` |\n",
+ "| **Search‑Term Generation** | Expand/clean user query into rich keyword list | `gpt‑4.1` |\n",
+ "| **Conduct Research** | Run web & internal searches, rank & summarize results | `gpt‑4.1` + tools |\n",
+ "| **Draft Report** | Produce first narrative with reasoning & inline citations | `o3` |\n",
+ "| **Report Expansion** | Polish formatting, add charts / images / appendix | `gpt‑4.1` + tools |"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "dcb4e6dc",
+ "metadata": {},
+ "source": [
+ "### 3 — High‑Level Architecture \n",
+ "The following diagram groups agents and tools:\n",
+ "\n",
+ "* **Research Planning Agent** – interprets the user request and produces a research plan/agenda.\n",
+ "* **Knowledge Assistant Agent** – orchestrates parallel web & file searches via built‑in tools, curates short‑term memory.\n",
+ "* **Web Search Agent(s)** – perform Internet queries, deduplicate, rank and summarize pages.\n",
+ "* **Report Creation Agent** – consumes curated corpus and drafts the structured report.\n",
+ "* **(Optional) Data Analysis Agent** – executes code for numeric/CSV analyses via the Code Interpreter tool.\n",
+ "* **(Optional) Image‑Gen Agent** – generates illustrative figures.\n",
+ "\n",
+ "Input/output guardrails wrap user prompts and final content for policy, safety and citation checks."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d3464739",
+ "metadata": {},
+ "source": [
+ "### 4 — Pre-requisites \n",
+ "\n",
+ "Create a virual environment \n",
+ "\n",
+ "Install dependencies "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "3a16ac1f",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
+ "source": [
+ "%pip install openai openai-agents --quiet"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "69135215",
+ "metadata": {},
+ "source": [
+ "### 5 — Agents (Pseudo Code) \n",
+ "Below are skeletal class definitions illustrating how each agent’s policy and tool‑usage might look."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b9f3062e",
+ "metadata": {},
+ "source": [
+ "#### Step 1 - Query Expansion\n",
+ "\n",
+ "The query expansion step ensures the subsequent agents conducting research have sufficient context of user's inquiry. \n",
+ "\n",
+ "The first step is to understand user's intent, and make sure the user has provided sufficient details for subsequent agents to search the web, build a knowledge repository, and prepare a deep dive report. The `query_expansion_agent.py` accomplishes this with the prompt that outlines minimum information needed from the user to generate a report. This could include timeframe, industry, target audience, etc. The prompt can be tailored to the need of your deep research assistant. The agent will put a `is_task_clear` yes or no, when its no, it would prompt the user with additional questions, if sufficient information is available, it would output the expanded prompt. \n",
+ "\n",
+ "This is also an opportunity to enforce input guardrails for any research topics that you'd like to restrict the user from researching based on your usage policies. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f2618f60",
+ "metadata": {},
+ "source": [
+ "##### Input Guardrails with Agents SDK \n",
+ "Let's assume our fictitious guardrail is to prevent the user from generating a non-AI related topic report. For this we will define a guardrail agent. The guardrail agent `topic_content_guardrail.py` checks whether the topic is related to AI, if not, it raises an exception. The function `ai_topic_guardrail` is passed to the `QueryExpansionAgent()` as `input_guardrails`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "620f9e40",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "🚫 Guardrail tripped – not an AI topic: The user's request focuses on the luxury goods market, which pertains to market trends in the luxury sector rather than artificial intelligence. Therefore, it is not about AI.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from ai_research_assistant_resources.agents_tools_registry.query_expansion_agent import QueryExpansionAgent\n",
+ "from agents import InputGuardrailTripwireTriggered\n",
+ "\n",
+ "query_expansion_agent_guardrail_check = QueryExpansionAgent()\n",
+ "\n",
+ "try:\n",
+ "\n",
+ " result = await query_expansion_agent_guardrail_check.task(\"Write a research report on the latest trends in luxury goods market\")\n",
+ "\n",
+ "except InputGuardrailTripwireTriggered as e:\n",
+ " reason = e.guardrail_result.output.output_info.reasoning\n",
+ " # └─────┬─────┘\n",
+ " # GuardrailFunctionOutput\n",
+ " print(\"🚫 Guardrail tripped – not an AI topic:\", reason)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "77364239",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "The task is not clear. The agent asks:\n",
+ " 1. What timeframe should the report cover (e.g., the past year, the past five years, up to current date)?\n",
+ "2. Should the report focus on specific AI subfields (e.g., natural language processing, computer vision, reinforcement learning) or provide a general overview?\n",
+ "3. Are there particular industries or application domains (e.g., healthcare, finance, manufacturing) you want the report to emphasize?\n",
+ "4. What length or depth do you expect for the report (e.g., a brief summary, a detailed 20-page analysis)?\n",
+ "5. Who is the target audience for the report (e.g., technical researchers, business executives, policymakers)?\n",
+ "\n",
+ "\n",
+ "user input: 5 years, AI in healthcare, exec summary \n",
+ "\n",
+ "Expanded query:\n",
+ " Draft an executive summary research report on the latest trends in AI developments in healthcare over the past five years. Summarize key advancements across major subfields such as diagnostic imaging, predictive analytics, natural language processing for clinical documentation, and personalized medicine. Highlight impactful case studies, emerging technologies, regulatory considerations, and potential challenges. Provide high-level insights on market adoption, ROI metrics, and strategic recommendations for healthcare executives.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from ai_research_assistant_resources.agents_tools_registry.query_expansion_agent import QueryExpansionAgent\n",
+ "\n",
+ "query_expansion_agent = QueryExpansionAgent()\n",
+ "\n",
+ "# Initial prompt to the agent\n",
+ "prompt: str = \"Draft a research report on the latest trends in AI developments\"\n",
+ "expanded_query = \"\" \n",
+ "\n",
+ "try: \n",
+ "\n",
+ " while True:\n",
+ " # Execute the agent with the current prompt\n",
+ " result = await query_expansion_agent.task(prompt)\n",
+ "\n",
+ " # When the task is clear, show the expanded query and exit.\n",
+ " if result.is_task_clear == \"yes\":\n",
+ " expanded_query = result.expanded_query\n",
+ " print(\"\\nExpanded query:\\n\", expanded_query)\n",
+ " break\n",
+ "\n",
+ " # Otherwise, display the clarifying questions and ask the user for input.\n",
+ " print(\"\\nThe task is not clear. The agent asks:\\n\", result.questions)\n",
+ " prompt = input(\"Please provide the missing details so I can refine the query: \")\n",
+ " print(\"\\n\")\n",
+ " print(\"user input: \", prompt)\n",
+ " \n",
+ "\n",
+ "except Exception as e:\n",
+ " print(\"Non-AI topic guardrail tripped!\", e)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6b1b10e7",
+ "metadata": {},
+ "source": [
+ "#### Step 2 - Web Search Terms "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "725969cb",
+ "metadata": {},
+ "source": [
+ "Conducting Web search is typically an integral part of the deep research process. First we generate web search terms relevant to the research report. In the next step we will search the web and build a knowledge repository of the data.\n",
+ "\n",
+ "The `WebSearchTermsGenerationAgent` takes as input the the expanded prompt, and generates succinct search terms. You can structure the search term generation prompt according to your user's typical requirements such as include adjacent industries in the search terms, include competitors, etc. Additionally, you can also control how much data you want to gather e.g., number of search terms to generate. In our case, we will limit to 3 search terms. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "f15e0c10",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "1. Latest AI trends in healthcare 2025 report\n",
+ "2. Advancements in AI for diagnostic imaging and predictive analytics 2020-2025\n",
+ "3. Impactful AI case studies in healthcare and market adoption analysis 2025\n"
+ ]
+ }
+ ],
+ "source": [
+ "from ai_research_assistant_resources.agents_tools_registry.web_search_terms_generation_agent import WebSearchTermsGenerationAgent\n",
+ "\n",
+ "search_terms_agent = WebSearchTermsGenerationAgent(3)\n",
+ "\n",
+ "result = await search_terms_agent.task(expanded_query)\n",
+ "\n",
+ "search_terms_raw = result\n",
+ "\n",
+ "for i, query in enumerate(search_terms_raw.Search_Queries, start=1):\n",
+ " print(f\"{i}. {query}\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3feeaae8",
+ "metadata": {},
+ "source": [
+ "### Step 3 - Web Search: Build an Inventory of Data Sources\n",
+ "\n",
+ "In this step, we will use the OpenAI web search tool that is integrated into the `responses` API to identify and collect knowledge content that will form the baseline for our report. This tool allows you to search the web and retrieve relevant information and citations directly within your workflow, without needing to set up any external search APIs or browser automation.\n",
+ "\n",
+ "You can learn more about the OpenAI web search tool here: [OpenAI Web Search Tool Documentation](https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses).\n",
+ "\n",
+ "The OpenAI web search tool is a convenient, out-of-the-box solution for most research use cases. However, if you require more fine-grained control over the information retrieved (for example, to exclude certain sources, apply custom filters, or use a specific search engine), you can also build and use your own browser-based or Google Custom Search integration. For an example of building a custom web search and retrieval pipeline, see [Building a Bring Your Own Browser (BYOB) Tool for Web Browsing and Summarization](https://cookbook.openai.com/examples/third_party/web_search_with_google_api_bring_your_own_browser_tool).\n",
+ "\n",
+ "The process for building your research data inventory using the OpenAI web search tool is as follows:\n",
+ "\n",
+ "1. Obtain the search results (e.g., top 10 relevant pages) for each search term.\n",
+ "2. Extract and summarize the key points from each result.\n",
+ "3. Optionally, apply output guardrails to filter out irrelevant or undesirable results (for example, based on publication date, source, or content).\n",
+ "#\n",
+ "If you choose to implement your own custom search or browser-based retrieval, you may need additional setup such as API keys or environment configuration."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "7b7260c5",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Search Query 1: Latest AI trends in healthcare 2025 report\n",
+ "Search Query 2: Advancements in AI for diagnostic imaging and predictive analytics 2020-2025\n",
+ "Search Query 3: Impactful AI case studies in healthcare and market adoption analysis 2025\n",
+ "Results written to research_results.json\n"
+ ]
+ }
+ ],
+ "source": [
+ "from ai_research_assistant_resources.utils.web_search_and_util import get_results_for_search_term\n",
+ "import json\n",
+ "\n",
+ "research_results = []\n",
+ "\n",
+ "for idx, query in enumerate(search_terms_raw.Search_Queries, 1):\n",
+ " print(f\"Search Query {idx}: {query}\")\n",
+ " research_results.append(get_results_for_search_term(query))\n",
+ "\n",
+ "if research_results: \n",
+ " with open(\"research_results.json\", \"w\", encoding=\"utf-8\") as f:\n",
+ " json.dump(research_results, f, indent=2, ensure_ascii=False)\n",
+ " print(\"Results written to research_results.json\")\n",
+ "else:\n",
+ " print(\"No results returned.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e9758743",
+ "metadata": {},
+ "source": [
+ "### Step-4: Create a report"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "076a6f22",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "✅ Report written to REPORT_DRAFT.md\n"
+ ]
+ }
+ ],
+ "source": [
+ "from ai_research_assistant_resources.agents_tools_registry.report_writing_agent import (\n",
+ " ReportWritingAgent,\n",
+ ")\n",
+ "import json\n",
+ "from pathlib import Path\n",
+ "\n",
+ "# ------------------------------------------------------------------\n",
+ "# 1. Load research results\n",
+ "# ------------------------------------------------------------------\n",
+ "with open(\"research_results.json\", \"r\", encoding=\"utf-8\") as f:\n",
+ " research_results = f.read()\n",
+ "\n",
+ "# ------------------------------------------------------------------\n",
+ "# 2. Draft the report\n",
+ "# ------------------------------------------------------------------\n",
+ "outline = \"\"\" Draft a comprehensive research report analyzing the latest trends in artificial intelligence (AI) developments within the healthcare industry over the past five years. The report should evaluate advancements in machine learning, deep learning, natural language processing, medical imaging, and other relevant AI applications, while also examining regulatory, ethical, and operational impacts on healthcare delivery. Include detailed case studies, emerging research areas, and recommendations for future innovation in the industry.\"\"\" # ← customize as needed\n",
+ "\n",
+ "report_agent = ReportWritingAgent(research_resources=research_results)\n",
+ "\n",
+ "draft_md = await report_agent.task(outline)\n",
+ "\n",
+ "# ------------------------------------------------------------------\n",
+ "# 4. Persist to file\n",
+ "# ------------------------------------------------------------------\n",
+ "Path(\"REPORT_DRAFT.md\").write_text(draft_md, encoding=\"utf-8\")\n",
+ "print(\"✅ Report written to REPORT_DRAFT.md\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d0f4f1a8",
+ "metadata": {},
+ "source": [
+ "### Step-5: Report Expansion or Scouting for additional data points (OPTIONAL)\n",
+ "\n",
+ "If you have a large corpus of data, you may have a secondary report expansion agent review each section of the report, and add content that may have been overlooked in the first pass by the report writer. This can be selectively done for a section, or for all sections based on your use case. \n",
+ "\n",
+ "While it is beyond the purview of this Cookbook, the overall architecture is as follows. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "586ee533",
+ "metadata": {},
+ "source": [
+ "### Step-6: Organize the with References and Table of Content \n",
+ "\n",
+ "We let the LLM focus on generating the content, the content formatting such as creating a Table of Content upfront, and move references to the end. \n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "7ad9315b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import re\n",
+ "\n",
+ "def update_references(file_path, search_results_json):\n",
+ " \"\"\"\n",
+ " Update the references in a Markdown file by extracting unique URLs from tags and creating a\n",
+ " References section at the end of the file.\n",
+ "\n",
+ " :param file_path: The path to the Markdown file.\n",
+ " \"\"\"\n",
+ " global content\n",
+ " # Read the markdown_content of the MD file\n",
+ "\n",
+ " global url_to_title\n",
+ " # Load the search results\n",
+ " # Create a dictionary for quick lookup of titles by URL\n",
+ " url_to_title = {entry[\"URL\"]: entry[\"title\"] for entry in search_results_json}\n",
+ "\n",
+ " with open(file_path, 'r') as file:\n",
+ " content = file.read()\n",
+ " # Remove the existing References section if it exists\n",
+ " content = re.sub(r'\\n## References[\\s\\S]*', '', content)\n",
+ " content = re.sub(r'\\n### References[\\s\\S]*', '', content)\n",
+ "\n",
+ " # Find all tags and extract the URLs\n",
+ " sources = re.findall(r'(.*?)', content)\n",
+ " # Eliminate duplicates while maintaining order\n",
+ " unique_sources = []\n",
+ " unique_references = {}\n",
+ " for source in sources:\n",
+ " if source not in unique_sources:\n",
+ " unique_sources.append(source)\n",
+ " unique_references[source] = unique_sources.index(source) + 1\n",
+ " # Create the References section\n",
+ " references_section = \"\\n\\n## References\\n\"\n",
+ "\n",
+ " for i, source in enumerate(unique_sources, start=1):\n",
+ " title = url_to_title.get(source, \"Source not found in the search results\")\n",
+ " references_section += f\"{i}. [{title}]({source})\\n\"\n",
+ " # references_section += f\"{i}. {source}\\n\"\n",
+ "\n",
+ " # Replace tags with [reference #]\n",
+ " for source, reference_number in unique_references.items():\n",
+ " # markdown_content = markdown_content.replace(f'{source}', f'[reference {reference_number}]')\n",
+ " content = content.replace(f'{source}', f'[[{reference_number}]({source})]')\n",
+ " # Append the References section to the markdown_content\n",
+ " content += references_section\n",
+ " # Save the modified markdown_content back to the file\n",
+ " with open(file_path, 'w') as file:\n",
+ " file.write(content)\n",
+ " \n",
+ " \n",
+ "def add_toc_to_markdown(file_path):\n",
+ " \"\"\"\n",
+ " Add a Table of Contents (TOC) to a Markdown file by generating links to the headings in the file.\n",
+ "\n",
+ " :param file_path: The path to the Markdown file.\n",
+ " \"\"\"\n",
+ "\n",
+ " def generate_toc_line(line):\n",
+ " level = line.count('#') - 2\n",
+ " heading = line.strip().lstrip('#').strip()\n",
+ " link = heading.lower().replace(' ', '-').replace('.', '').replace(',', '')\n",
+ " return f\"{' ' * level}- [{heading}](#{link})\\n\"\n",
+ "\n",
+ " with open(file_path, 'r') as file:\n",
+ " lines = file.readlines()\n",
+ "\n",
+ " toc_lines = []\n",
+ " content_start_index = 0\n",
+ " for i, line in enumerate(lines):\n",
+ " if line.startswith('## '):\n",
+ " content_start_index = i\n",
+ " break\n",
+ "\n",
+ " for line in lines[content_start_index:]:\n",
+ " if line.startswith('## ') or line.startswith('### '):\n",
+ " toc_lines.append(generate_toc_line(line))\n",
+ "\n",
+ " toc_content = \"# Table of Contents\\n\" + ''.join(toc_lines) + \"\\n---\\n\\n\"\n",
+ " new_content = toc_content + ''.join(lines)\n",
+ "\n",
+ " with open(file_path, 'w') as file:\n",
+ " file.write(new_content)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fb69c797",
+ "metadata": {},
+ "source": [
+ "### 5 — Guardrails & Best Practices \n",
+ "* **Crawl → Walk → Run**: start with a single agent, then expand into a swarm. \n",
+ "* **Expose intermediate reasoning** (“show the math”) to build user trust. \n",
+ "* **Parameterize UX** so analysts can tweak report format and source mix. \n",
+ "* **Native OpenAI tools first** (web browsing, file ingestion) before reinventing low‑level retrieval. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1bdcab82",
+ "metadata": {},
+ "source": [
+ "### 6 — Risks & Mitigation \n",
+ "| Pitfall | Mitigation |\n",
+ "|---------|------------|\n",
+ "| Scope‑creep & endless roadmap | Narrow MVP & SMART milestones | fileciteturn1file4L23-L24 |\n",
+ "| Hallucinations & weak guardrails | Golden‑set evals, RAG with citation checks | fileciteturn1file4L25-L26 |\n",
+ "| Run‑away infra costs | Cost curve modelling; efficient models + autoscaling | fileciteturn1file4L27-L28 |\n",
+ "| Talent gaps | Upskill & leverage Agents SDK to offload core reasoning | fileciteturn1file4L29-L30 |"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5b40dcf3",
+ "metadata": {},
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "openai",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/examples/agents_sdk/REPORT_DRAFT.md b/examples/agents_sdk/REPORT_DRAFT.md
new file mode 100644
index 0000000000..9798aca68c
--- /dev/null
+++ b/examples/agents_sdk/REPORT_DRAFT.md
@@ -0,0 +1,62 @@
+# Artificial Intelligence in Healthcare: A Five-Year Trend Analysis (2020 – 2025)
+
+## 1. Introduction and Scope
+###
+Over the past half-decade, artificial intelligence (AI) has evolved from a set of promising proofs-of-concept to a foundational technology across nearly every layer of healthcare delivery. Spanning machine learning (ML), deep learning (DL), natural language processing (NLP), computer vision, and hybrid approaches, AI systems now routinely assist in diagnostics, therapeutics, administration, and population health management. Market analysts estimate that the global AI-in-healthcare sector will expand from roughly USD 39 billion in 2025 to almost USD 491 billion by 2032, reflecting a 43 % compound annual growth rate and underscoring the strategic importance of continued innovation and governance in this domain https://www.fortunebusinessinsights.com/industry-reports/artificial-intelligence-in-healthcare-market-100534?utm_source=openai.
+
+This report synthesizes peer-reviewed studies, market analyses, and recent case studies from 2020-2025 to map the trajectory of AI innovation. It evaluates advancements in ML/DL algorithms, NLP, medical imaging, surgical and drug-discovery applications, and operational use cases. Further, it critically examines regulatory, ethical, and organizational considerations, before proposing recommendations to accelerate responsible adoption.
+
+## 2. Machine Learning & Deep Learning for Diagnostics
+###
+ML and DL have markedly improved diagnostic accuracy by learning complex patterns in multimodal data. Google’s DeepMind, for instance, achieved a 94.5 % accuracy rate in detecting eye diseases, outperforming seasoned specialists and illustrating the ability of convolutional neural networks to generalize across large ophthalmology datasets https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai. Parallel advances in oncology leverage DL to analyze histopathology slides, predicting tumor aggressiveness and supporting precision medicine workflows.
+
+Equally significant are predictive analytics models that comb electronic health records (EHRs) to identify high-risk patients. AI-driven tools now detect sepsis hours before clinical manifestation and forecast multiple-sclerosis progression months in advance, enabling prophylactic interventions and lowering readmission rates https://blog.medicai.io/en/future-of-medical-imaging/?utm_source=openai. These gains, however, demand rigorous validation to mitigate automation bias and ensure equitable performance across demographic subgroups.
+
+## 3. Natural Language Processing & Conversational AI
+###
+NLP has transitioned from rule-based systems to transformer models capable of contextual understanding. Healthcare chatbots and virtual health assistants deliver 24/7 triage, medication adherence reminders, and mental-health coaching; the global chatbot market alone is on track for a 21.5 % CAGR, approaching USD 544 million by 2030 https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai. On the provider side, ambient “digital scribe” platforms such as Heidi Health automatically generate SOAP notes and discharge summaries, now supporting over one million patient encounters weekly across several countries https://en.wikipedia.org/wiki/Heidi_Health?utm_source=openai.
+
+Clinical documentation has further been enhanced by generative-AI models that outperform surgeons in drafting post-operative reports—cutting time, reducing omissions, and freeing clinicians for direct patient care https://www.reuters.com/business/healthcare-pharmaceuticals/health-rounds-ai-tops-surgeons-writing-post-operative-reports-2025-02-14/?utm_source=openai. Yet, integrating these models into electronic workflows raises questions about data provenance, liability, and clinician oversight.
+
+## 4. AI in Medical Imaging & Predictive Analytics
+###
+Imaging has been one of AI’s earliest and most profound success stories. DL algorithms now match or surpass expert radiologists in detecting lung nodules, breast lesions, and cerebral hemorrhages, while real-time image fusion (e.g., PET-MRI) allows dynamic visualization of tumor metabolism alongside anatomical context https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai. Techniques such as Deep Tomographic Reconstruction reduce noise and radiation exposure, enabling low-dose CT and rapid MRI without sacrificing resolution https://en.wikipedia.org/wiki/Deep_Tomographic_Reconstruction?utm_source=openai.
+
+Predictive models built on longitudinal imaging plus clinical data anticipate strokes, cardiac events, and treatment responses. Integrations with EHRs provide clinicians with risk-stratified dashboards, accelerating time to intervention and enhancing population-health initiatives https://pmc.ncbi.nlm.nih.gov/articles/PMC11799571/?utm_source=openai. Nonetheless, scalability hinges on standardized data pipelines and interoperability standards, areas where many health systems still lag.
+
+## 5. Surgical Robotics, Drug Discovery & Remote Monitoring
+###
+AI-assisted robotic platforms have catalyzed a new era of minimally invasive surgery. The AI-enabled surgical robotics market is projected to top USD 14.7 billion by 2026, with systems delivering sub-millimeter precision, reduced complication rates, and shortened recovery times https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai. Outside the operating room, generative models expedite drug discovery; Insilico Medicine identified a fibrosis candidate molecule in just 46 days, exemplifying the compression of traditional R&D timelines https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai.
+
+Remote patient monitoring (RPM) leverages AI to analyze data from wearables, flagging arrhythmias or glycemic excursions before they escalate. The RPM market is expanding 20 % annually toward USD 175 billion by 2027, signaling a shift from episodic to continuous care https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai. Such distributed models offer scalability but demand robust cybersecurity and reimbursement frameworks.
+
+## 6. Operational & Administrative Transformation
+###
+Beyond clinical tasks, AI optimizes revenue-cycle management, scheduling, and supply-chain logistics. Wolters Kluwer highlights AI-enabled clinical-decision support and administrative automation as top healthcare technology trends for 2025, citing reductions in clinician burnout and operating costs https://www.wolterskluwer.com/en/news/wolters-kluwer-25-for-25-report-predicts-key-healthcare-technology-trends?utm_source=openai.
+
+India’s Apollo Hospitals illustrates tangible impact: AI-driven documentation and clinical-support tools free two to three hours of daily staff time, improving throughput amid nursing shortages and a planned 33 % bed-capacity expansion https://www.reuters.com/business/healthcare-pharmaceuticals/indias-apollo-hospitals-bets-ai-tackle-staff-workload-2025-03-13/?utm_source=openai. Venture investment echoes these gains; startups secured over USD 35 billion in the first half of 2024 for ambient documentation and revenue-cycle platforms https://www.futuremarketinsights.com/reports/artificial-intelligence-in-healthcare-market?utm_source=openai.
+
+## 7. Regulatory, Ethical & Data-Security Considerations
+###
+Rapid deployment has intensified scrutiny on privacy, bias, and accountability. Scholars warn of “automation bias,” where clinicians over-rely on algorithmic output without adequate verification—a risk magnified in diagnostic AI systems that lack transparent reasoning pathways https://arxiv.org/abs/2502.16732?utm_source=openai. Concurrently, integrating AI with blockchain offers immutable audit trails, promoting HIPAA compliance and mitigating data-breach risks https://arxiv.org/abs/2501.02169?utm_source=openai.
+
+Global regulators are responding with draft frameworks that emphasize human-in-the-loop oversight, performance monitoring, and equitable dataset curation. Ethical guidelines also stress the need to evaluate social determinants of health to prevent perpetuating disparities, particularly in mental-health AI applications https://en.wikipedia.org/wiki/Artificial_intelligence_in_mental_health?utm_source=openai. Still, absence of a clear liability model for AI-assisted diagnosis remains a formidable barrier to widespread clinical trust.
+
+## 8. Case Studies Demonstrating Real-World Impact
+###
+Several implementations confirm AI’s capacity to enhance outcomes and efficiency. The University of Pittsburgh and Leidos channeled USD 10 million into AI tools that cut leukemia reporting times and support underserved communities, showcasing how generative models can reduce diagnostic disparities https://www.axios.com/local/pittsburgh/2025/04/18/pitt-leidos-use-ai-to-fight-cancer-and-health-disparities?utm_source=openai. Meanwhile, UK-based C2-Ai applies risk stratification and behavioral coaching to surgical wait-lists, lowering complication rates sixfold and halving readmissions across 2,000 patients https://www.ft.com/content/37b79af4-116f-46e5-9bbd-b814aa4c95af?utm_source=openai.
+
+Imaging networks also benefit: Mercy health system integrated Aidoc’s aiOS platform to triage radiology studies, accelerating time-critical findings and standardizing workflows across sites https://en.wikipedia.org/wiki/Aidoc?utm_source=openai. Collectively, these cases evidence financial and clinical ROI, yet emphasize the necessity for robust change-management strategies and continuous algorithm auditing.
+
+## 9. Emerging Research Directions & Recommendations
+###
+Next-generation AI research is converging on multimodal foundation models capable of ingesting text, images, genomics, and physiologic signals to produce holistic patient representations. Combining such models with federated-learning architectures may enable cross-institutional insights while preserving data sovereignty https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai. Additionally, explainable-AI (XAI) techniques, from saliency maps to counterfactual reasoning, are poised to enhance clinician trust and regulatory compliance.
+
+To sustain momentum, stakeholders should:
+1. Establish standardized benchmarks and real-world evidence repositories for continual algorithm validation.
+2. Incentivize development of bias-mitigation toolkits and ethical-impact assessments.
+3. Expand reimbursement pathways for AI-enabled preventive care and RPM.
+4. Foster public-private partnerships to pilot blockchain-secured data-exchange frameworks.
+5. Cultivate AI literacy among clinicians through integrated education modules, ensuring human oversight remains central to patient care.
+
+By embedding these principles, the healthcare ecosystem can harness AI’s transformative potential while safeguarding equity, safety, and trust.
\ No newline at end of file
diff --git a/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/query_expansion_agent.py b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/query_expansion_agent.py
new file mode 100644
index 0000000000..9042dc4b49
--- /dev/null
+++ b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/query_expansion_agent.py
@@ -0,0 +1,100 @@
+# query_expansion_agent.py
+from agents import Agent, Runner
+from pydantic import BaseModel
+from typing import Literal
+from agents.run import RunConfig
+from typing import Optional
+from ..guardrails.topic_content_guardrail import ai_topic_guardrail
+
+class QueryExpansion(BaseModel):
+ """Structured output model for the query-expansion agent."""
+
+ expanded_query: str
+ questions: str
+ is_task_clear: Literal["yes", "no"]
+
+
+class QueryExpansionAgent:
+ """A wrapper class that internally creates an `agents.Agent` instance on construction.
+
+ Example
+ -------
+ >>> query_agent = QueryExpansionAgent()
+ >>> prompt = "Draft a research report on the latest trends in AI in the last 5 years."
+ >>> expanded_prompt = query_agent.task(prompt)
+ >>> print(expanded_prompt)
+ """
+
+ _DEFAULT_NAME = "Query Expansion Agent"
+
+ _DEFAULT_INSTRUCTIONS = """You are a helpful agent who receives a raw research prompt from the user.
+
+ 1. Determine whether the task is sufficiently clear to proceed (“task clarity”).
+ 2. If the task is missing timeframe of the research or the industry/domain, ask the user for the missing information.
+ 3. If the task *is* clear, expand the prompt into a single, well-structured paragraph that makes the research request specific, actionable, and self-contained • Do **not** add any qualifiers or meta-commentary; write only the improved prompt itself.
+ 4. If the task *is not* clear, generate concise clarifying questions that will make the request actionable. Prioritize questions about:
+ • Domain / industry focus
+ • Timeframe (e.g., current year 2025, last 5 years, last 10 years, or all time)
+ • Any other missing constraints or desired perspectives
+
+ Return your response **exclusively** as a JSON object with these exact fields:
+
+ ```json
+ {
+ "expanded_query": "",
+ "questions": "",
+ "is_task_clear": "yes" | "no"
+ }
+ ```
+
+ When "is_task_clear" is "yes", populate "expanded_query" with the enhanced one-paragraph prompt and leave "questions" empty.
+
+ When "is_task_clear" is "no", populate "questions" with your list of clarifying questions and leave "expanded_query" empty.
+
+ """
+
+ def __init__(self, *, model: str = "o4-mini", tools: list | None = None, name: str | None = None,
+ instructions: str | None = None, input_guardrails: list | None = None):
+
+ # Initialise the underlying `agents.Agent` with a structured `output_type` so it
+ # returns a validated `QueryExpansion` instance instead of a raw string.
+ self._agent = Agent(
+ name=name or self._DEFAULT_NAME,
+ instructions=instructions or self._DEFAULT_INSTRUCTIONS,
+ tools=tools or [],
+ model=model,
+ output_type=QueryExpansion,
+ input_guardrails=input_guardrails or [ai_topic_guardrail],
+ )
+ self._last_result = None
+
+ # ------------------------------------------------------------------
+ # Public helpers
+ # ------------------------------------------------------------------
+
+ @property
+ def agent(self) -> Agent: # type: ignore[name-defined]
+ """Return the underlying ``agents.Agent`` instance."""
+ return self._agent
+
+ async def task(self, prompt: str) -> QueryExpansion:
+ """Fire-and-forget API that auto-threads each call."""
+
+ cfg = RunConfig(tracing_disabled=True)
+
+ # ── First turn ──────────────────────────────────────────────
+ if self._last_result is None:
+ self._last_result = await Runner.run(
+ self._agent, prompt, run_config=cfg
+ )
+ # ── Later turns ─────────────────────────────────────────────
+ else:
+ new_input = (
+ self._last_result.to_input_list() +
+ [{"role": "user", "content": prompt}]
+ )
+ self._last_result = await Runner.run(
+ self._agent, new_input, run_config=cfg
+ )
+
+ return self._last_result.final_output
diff --git a/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/report_writing_agent.py b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/report_writing_agent.py
new file mode 100644
index 0000000000..b0a7075a9a
--- /dev/null
+++ b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/report_writing_agent.py
@@ -0,0 +1,109 @@
+from agents import Agent, Runner, RunConfig
+
+
+class ReportWritingAgent:
+ _DEFAULT_NAME = "Report Writing Agent"
+
+ # NOTE: Double braces around RESOURCES so that str.format leaves them intact when formatting other placeholders.
+ REPORT_WRITER = """You are a report writer that that writes a detailed report in Markdown file format on a report outline \
+ provided by the user citing sources in . Use a formal tone.
+
+ Follow the following rules:
+
+ 1. Take your time to analyze the topic provided by the user, and review all the sources provided in REFERENCE RESOURCES.
+
+ 2. Do you own synthesis of sources presented in REFERENCE RESOURCES. Draw conclusions from the sources.
+
+ 3. For each section of the report write 2 to 3 paragraphs using as many REFERENCE RESOURCES as applicable.
+
+ 4. Use Markdown header # for title, ## for section header, and ### for detailed content in the sections. Keep detailed \
+ sections to between 6 and 10.
+
+ 5. Cite sources that you use from REFERENCE RESOURCES in tags. You don't need to provide title of the \
+ source.
+
+ For example:
+ Robust integration within Apple's ecosystem, set it apart from competitors
+ https://618media.com/en/blog/apple-vision-pro-vs-competitors-a-comparison
+
+ 6. Do not include any additional sources not provided in REFERENCE RESOURCES below.
+
+ The resources are provide in a JSON format below:
+
+
+ {{{RESOURCES}}}
+
+ """
+
+ def __init__(
+ self,
+ research_resources: str,
+ *,
+ model: str = "o3",
+ tools: list | None = None,
+ name: str | None = None,
+ instructions: str | None = None,
+ ) -> None:
+ """Create an agent capable of writing a detailed Markdown report.
+
+ Parameters
+ ----------
+ research_resources: str
+ A string containing reference resources (e.g., URLs, snippets) that will be injected into the default
+ prompt, replacing the ``{{{RESOURCES}}}`` placeholder.
+ model: str, optional
+ Name of the model to use. Defaults to ``"o3"``.
+ tools: list, optional
+ Optional list of tools to pass into the underlying ``agents.Agent``.
+ name: str, optional
+ Custom name for the agent instance.
+ instructions: str, optional
+ If provided, these instructions override the default prompt.
+ """
+
+ # ------------------------------------------------------------------
+ # Handle different input formats for `research_resources`.
+ # If a string is provided, we use it directly; otherwise, convert JSON
+ # objects (list / dict) into the required Markdown-friendly string.
+ # ------------------------------------------------------------------
+
+ resources_str: str = research_resources
+
+ # Use custom instructions if supplied, otherwise format the template with the given resources.
+ formatted_instructions = instructions or self.REPORT_WRITER.replace(
+ "{{{RESOURCES}}}", resources_str
+ )
+
+ self._agent = Agent(
+ name=name or self._DEFAULT_NAME,
+ instructions=formatted_instructions,
+ tools=tools or [],
+ model=model,
+ )
+
+ # ------------------------------------------------------------------
+ # Public helpers
+ # ------------------------------------------------------------------
+
+ @property
+ def agent(self) -> Agent: # type: ignore[name-defined]
+ """Return the underlying :class:`agents.Agent` instance."""
+ return self._agent
+
+ async def task(self, outline: str) -> str:
+ """Generate a Markdown report based on the provided outline.
+
+ Parameters
+ ----------
+ outline: str
+ The outline or prompt describing the desired report structure.
+
+ Returns
+ -------
+ str
+ A Markdown formatted report following the provided outline and referencing the supplied resources.
+ """
+
+ cfg = RunConfig(tracing_disabled=True)
+ result = await Runner.run(self._agent, outline, run_config=cfg)
+ return result.final_output
\ No newline at end of file
diff --git a/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/web_page_summary_agent.py b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/web_page_summary_agent.py
new file mode 100644
index 0000000000..46c991a6d6
--- /dev/null
+++ b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/web_page_summary_agent.py
@@ -0,0 +1,52 @@
+# web_page_summary_agent.py
+
+from agents import Agent, Runner, RunConfig
+
+
+class WebPageSummaryAgent:
+ _DEFAULT_NAME = "Web Page Summary Agent"
+
+ # NOTE: Placeholders will be filled at construction time so that the agent carries
+ # all contextual instructions. The task method will then only need the raw content.
+ _DEFAULT_INSTRUCTIONS = """You are an AI assistant tasked with summarising provided web page content.
+ "Return a concise summary in {character_limit} characters or less focused on '{search_term}'. "
+ "Only output the summary text; do not include any qualifiers or metadata."""
+
+ def __init__(
+ self,
+ search_term: str,
+ character_limit: int = 1000,
+ *,
+ model: str = "gpt-4.1",
+ tools: list | None = None,
+ name: str | None = None,
+ instructions: str | None = None,
+ ) -> None:
+ # Format instructions with the dynamic values unless explicitly overridden.
+ formatted_instructions = instructions or self._DEFAULT_INSTRUCTIONS.format(
+ search_term=search_term, character_limit=character_limit
+ )
+
+ self._agent = Agent(
+ name=name or self._DEFAULT_NAME,
+ instructions=formatted_instructions,
+ tools=tools or [],
+ model=model,
+ )
+
+ # ------------------------------------------------------------------
+ # Public helpers
+ # ------------------------------------------------------------------
+
+ @property
+ def agent(self) -> Agent: # type: ignore[name-defined]
+ """Return the underlying :class:`agents.Agent` instance."""
+
+ return self._agent
+
+ async def task(self, content: str) -> str:
+
+ cfg = RunConfig(tracing_disabled=True)
+
+ result = await Runner.run(self._agent, content, run_config=cfg)
+ return result.final_output
\ No newline at end of file
diff --git a/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/web_search_terms_generation_agent.py b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/web_search_terms_generation_agent.py
new file mode 100644
index 0000000000..5e23a6f853
--- /dev/null
+++ b/examples/agents_sdk/ai_research_assistant_resources/agents_tools_registry/web_search_terms_generation_agent.py
@@ -0,0 +1,77 @@
+from pydantic import BaseModel
+from agents import Agent, Runner, RunConfig
+
+_NUM_SEARCH_TERMS = 5
+
+class SearchTerms(BaseModel):
+ """Structured output model for search-terms suggestions."""
+
+ Search_Queries: list[str]
+
+
+class WebSearchTermsGenerationAgent:
+ _DEFAULT_NAME = "Search Terms Agent"
+
+ # Template for building default instructions at runtime.
+ # NOTE: Double braces are used so that ``str.format`` leaves the JSON braces intact.
+ _DEFAULT_INSTRUCTIONS_TEMPLATE = """You are a helpful agent assigned a research task. Your job is to provide the top
+ {num_search_terms} Search Queries relevant to the given topic in this year (2025). The output should be in JSON format.
+
+ Example format provided below:
+
+ {{
+ "Search_Queries": [
+ "Top ranked auto insurance companies US 2025 by market capitalization",
+ "Geico rates and comparison with other auto insurance companies",
+ "Insurance premiums of top ranked companies in the US in 2025",
+ "Total cost of insuring autos in US 2025",
+ "Top customer service feedback for auto insurance in 2025"
+ ]
+ }}
+
+ """
+
+
+ def __init__(
+ self,
+ num_search_terms: int = _NUM_SEARCH_TERMS,
+ *,
+ model: str = "gpt-4.1",
+ tools: list | None = None,
+ name: str | None = None,
+ instructions: str | None = None,
+ ):
+ # Store number of search terms for potential future use
+ self._num_search_terms = num_search_terms
+
+ # Build default instructions if none were provided.
+ final_instructions = (
+ instructions
+ or self._DEFAULT_INSTRUCTIONS_TEMPLATE.format(
+ num_search_terms=num_search_terms
+ )
+ )
+
+ self._agent = Agent(
+ name=name or self._DEFAULT_NAME,
+ instructions=final_instructions,
+ tools=tools or [],
+ model=model,
+ output_type=SearchTerms,
+ )
+
+ # ------------------------------------------------------------------
+ # Public helpers
+ # ------------------------------------------------------------------
+
+ @property
+ def agent(self) -> Agent: # type: ignore[name-defined]
+ """Return the underlying ``agents.Agent`` instance."""
+
+ return self._agent
+
+ async def task(self, prompt: str) -> SearchTerms: # type: ignore[name-defined]
+ """Execute the agent synchronously and return the structured ``SearchTerms`` output."""
+ cfg = RunConfig(tracing_disabled=True)
+ result = await Runner.run(self._agent, prompt, run_config=cfg)
+ return result.final_output
\ No newline at end of file
diff --git a/examples/agents_sdk/ai_research_assistant_resources/guardrails/topic_content_guardrail.py b/examples/agents_sdk/ai_research_assistant_resources/guardrails/topic_content_guardrail.py
new file mode 100644
index 0000000000..ec67fbb9e9
--- /dev/null
+++ b/examples/agents_sdk/ai_research_assistant_resources/guardrails/topic_content_guardrail.py
@@ -0,0 +1,62 @@
+# topic_guardrail.py
+from typing import List
+
+from pydantic import BaseModel
+
+from agents import ( # type: ignore (SDK imports)
+ Agent,
+ GuardrailFunctionOutput,
+ RunContextWrapper,
+ Runner,
+ TResponseInputItem,
+ input_guardrail,
+)
+
+# ---------------------------------------------------------------------------
+# 1. Tiny classifier agent → “Is this prompt about AI?”
+# ---------------------------------------------------------------------------
+
+
+class TopicCheckOutput(BaseModel):
+ """Structured result returned by the classifier."""
+
+ is_about_ai: bool # True → prompt is AI-related
+ reasoning: str # short rationale (useful for logs)
+
+
+topic_guardrail_agent = Agent(
+ name="Topic guardrail (AI)",
+ instructions=(
+ "You are a binary classifier. "
+ "Reply with is_about_ai = true **only** when the user's request is mainly "
+ "about artificial-intelligence research, applications, tooling, ethics, "
+ "policy, or market trends. "
+ "Return is_about_ai = false for all other domains (finance, biology, history, etc.)."
+ ),
+ model="gpt-4.1-mini", # lightweight, fast
+ output_type=TopicCheckOutput,
+)
+
+# ---------------------------------------------------------------------------
+# 2. Guardrail function (decorated) that wraps the classifier
+# ---------------------------------------------------------------------------
+
+
+@input_guardrail
+async def ai_topic_guardrail(
+ ctx: RunContextWrapper[None],
+ agent: Agent,
+ input: str | List[TResponseInputItem],
+) -> GuardrailFunctionOutput:
+ result = await Runner.run(topic_guardrail_agent, input, context=ctx.context)
+
+ output = GuardrailFunctionOutput(
+ output_info=result.final_output,
+ tripwire_triggered=not result.final_output.is_about_ai,
+ )
+
+ return output
+
+
+# Optional: tidy public surface
+__all__ = ["ai_topic_guardrail", "TopicCheckOutput"]
diff --git a/examples/agents_sdk/ai_research_assistant_resources/utils/web_search_and_util.py b/examples/agents_sdk/ai_research_assistant_resources/utils/web_search_and_util.py
new file mode 100644
index 0000000000..0e58b9fa22
--- /dev/null
+++ b/examples/agents_sdk/ai_research_assistant_resources/utils/web_search_and_util.py
@@ -0,0 +1,44 @@
+from openai import OpenAI
+
+client = OpenAI()
+
+
+def openai_web_search(
+ query: str,
+ model: str = "gpt-4.1",
+ search_context_size: str = "high",
+) -> dict:
+ resp = client.responses.create(
+ model=model,
+ tools=[
+ {"type": "web_search_preview", "search_context_size": search_context_size}
+ ],
+ input=f"Search the web for the following information and provide citations: {query}",
+ )
+
+ answer = ""
+ citations = []
+
+ for item in resp.output:
+ if item.type == "message":
+ for part in item.content:
+ if part.type == "output_text":
+ answer = part.text
+ for ann in part.annotations or []:
+ if ann.type == "url_citation":
+ citations.append(
+ {
+ "url": ann.url,
+ "title": getattr(ann, "title", None),
+ "start_index": getattr(ann, "start_index", None),
+ "end_index": getattr(ann, "end_index", None),
+ }
+ )
+
+ return {"answer": answer, "citations": citations}
+
+
+def get_results_for_search_term(
+ search_term: str, *, search_context_size: str = "high"
+) -> dict:
+ return openai_web_search(search_term, search_context_size=search_context_size)
diff --git a/examples/agents_sdk/research_results.json b/examples/agents_sdk/research_results.json
new file mode 100644
index 0000000000..752cc36643
--- /dev/null
+++ b/examples/agents_sdk/research_results.json
@@ -0,0 +1,197 @@
+[
+ {
+ "answer": "Artificial Intelligence (AI) is profoundly transforming the healthcare sector, with several key trends emerging in 2025:\n\n**1. AI-Powered Diagnostics**\n\nAI algorithms are enhancing diagnostic accuracy by analyzing medical images and patient data. For instance, Google's DeepMind achieved a 94.5% accuracy rate in diagnosing eye diseases, surpassing human specialists. ([voiceoc.com](https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai))\n\n**2. Conversational AI and Virtual Health Assistants**\n\nAI-driven chatbots and virtual assistants are improving patient engagement by providing 24/7 support, managing appointments, and offering personalized health information. The global healthcare chatbot market is projected to grow at a 21.5% CAGR, reaching approximately $543.65 million by 2030. ([voiceoc.com](https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai))\n\n**3. Generative AI in Drug Discovery**\n\nGenerative AI is accelerating drug discovery by predicting molecular behaviors and simulating patient populations, reducing development time and costs. For example, Insilico Medicine developed a potential drug for fibrosis in just 46 days using AI. ([voiceoc.com](https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai))\n\n**4. Remote Patient Monitoring and Telemedicine**\n\nAI enhances remote patient monitoring by analyzing data from wearables to predict health issues, enabling early interventions. The remote patient monitoring market is expected to grow 20% annually, reaching $175.2 billion by 2027. ([voiceoc.com](https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai))\n\n**5. AI in Surgery**\n\nAI-powered robotic systems are assisting in surgeries, improving precision and reducing complications. The AI-assisted surgical robotics market is projected to reach $14.7 billion by 2026. ([voiceoc.com](https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai))\n\n**6. Predictive Analytics for Disease Prevention**\n\nAI-driven predictive analytics are identifying individuals at risk of diseases, enabling proactive interventions. For instance, AI models can analyze behavioral and clinical data to predict and prevent suicide risks. ([en.wikipedia.org](https://en.wikipedia.org/wiki/Artificial_intelligence_in_mental_health?utm_source=openai))\n\n**7. AI in Healthcare Administration**\n\nAI is streamlining administrative tasks such as clinical documentation and patient scheduling, reducing clinician burnout. In 2025, AI is expected to further integrate into healthcare workflows, enhancing efficiency and productivity. ([wolterskluwer.com](https://www.wolterskluwer.com/en/news/wolters-kluwer-25-for-25-report-predicts-key-healthcare-technology-trends?utm_source=openai))\n\n**8. AI in Mental Health**\n\nAI applications in mental health include chatbots providing cognitive behavioral therapy and predictive analytics identifying individuals at risk of mental health disorders, facilitating early interventions. ([en.wikipedia.org](https://en.wikipedia.org/wiki/Artificial_intelligence_in_mental_health?utm_source=openai))\n\n**9. AI and Blockchain for Data Security**\n\nIntegrating AI with blockchain technology enhances the security and privacy of healthcare data, ensuring compliance with regulations like HIPAA. This combination addresses challenges related to data breaches and unauthorized access. ([arxiv.org](https://arxiv.org/abs/2501.02169?utm_source=openai))\n\n**10. Ethical Considerations and AI Regulation**\n\nAs AI adoption grows, addressing ethical concerns such as data privacy, algorithmic bias, and regulatory compliance becomes crucial. Establishing robust ethical frameworks is essential for responsible AI implementation in healthcare. ([arxiv.org](https://arxiv.org/abs/2501.01639?utm_source=openai))\n\nThese trends highlight AI's transformative impact on healthcare, offering opportunities to improve patient outcomes, enhance operational efficiency, and address critical challenges in the industry.\n\n\n## Recent Developments in AI Transforming Healthcare:\n- [How we can use AI to create a better society](https://www.ft.com/content/33ed8ad0-f8ad-42ed-983a-54d5b9eb2d27?utm_source=openai)\n- [Our Healthcare System Is Broken. Can Technology Help Heal It?](https://time.com/7203635/our-healthcare-system-is-broken-can-technology-help-heal-it/?utm_source=openai)\n- [Health Rounds: AI tops surgeons in writing post-operative reports](https://www.reuters.com/business/healthcare-pharmaceuticals/health-rounds-ai-tops-surgeons-writing-post-operative-reports-2025-02-14/?utm_source=openai) ",
+ "citations": [
+ {
+ "url": "https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai",
+ "title": "Top AI Trends in Healthcare 2025: Transforming the Future of Medical Innovation - Voiceoc",
+ "start_index": 368,
+ "end_index": 464
+ },
+ {
+ "url": "https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai",
+ "title": "Top AI Trends in Healthcare 2025: Transforming the Future of Medical Innovation - Voiceoc",
+ "start_index": 816,
+ "end_index": 912
+ },
+ {
+ "url": "https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai",
+ "title": "Top AI Trends in Healthcare 2025: Transforming the Future of Medical Innovation - Voiceoc",
+ "start_index": 1203,
+ "end_index": 1299
+ },
+ {
+ "url": "https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai",
+ "title": "Top AI Trends in Healthcare 2025: Transforming the Future of Medical Innovation - Voiceoc",
+ "start_index": 1583,
+ "end_index": 1679
+ },
+ {
+ "url": "https://www.voiceoc.com/blogs/ai-healthcare-trends-for-future?utm_source=openai",
+ "title": "Top AI Trends in Healthcare 2025: Transforming the Future of Medical Innovation - Voiceoc",
+ "start_index": 1892,
+ "end_index": 1988
+ },
+ {
+ "url": "https://en.wikipedia.org/wiki/Artificial_intelligence_in_mental_health?utm_source=openai",
+ "title": "Artificial intelligence in mental health",
+ "start_index": 2259,
+ "end_index": 2369
+ },
+ {
+ "url": "https://www.wolterskluwer.com/en/news/wolters-kluwer-25-for-25-report-predicts-key-healthcare-technology-trends?utm_source=openai",
+ "title": "Wolters Kluwer “25 for ‘25” report predicts key healthcare technology trends | Wolters Kluwer",
+ "start_index": 2645,
+ "end_index": 2797
+ },
+ {
+ "url": "https://en.wikipedia.org/wiki/Artificial_intelligence_in_mental_health?utm_source=openai",
+ "title": "Artificial intelligence in mental health",
+ "start_index": 3035,
+ "end_index": 3145
+ },
+ {
+ "url": "https://arxiv.org/abs/2501.02169?utm_source=openai",
+ "title": "The Integration of Blockchain and Artificial Intelligence for Secure Healthcare Systems",
+ "start_index": 3424,
+ "end_index": 3489
+ },
+ {
+ "url": "https://arxiv.org/abs/2501.01639?utm_source=openai",
+ "title": "Implications of Artificial Intelligence on Health Data Privacy and Confidentiality",
+ "start_index": 3775,
+ "end_index": 3840
+ },
+ {
+ "url": "https://www.ft.com/content/33ed8ad0-f8ad-42ed-983a-54d5b9eb2d27?utm_source=openai",
+ "title": "How we can use AI to create a better society",
+ "start_index": 4098,
+ "end_index": 4227
+ },
+ {
+ "url": "https://time.com/7203635/our-healthcare-system-is-broken-can-technology-help-heal-it/?utm_source=openai",
+ "title": "Our Healthcare System Is Broken. Can Technology Help Heal It?",
+ "start_index": 4230,
+ "end_index": 4398
+ },
+ {
+ "url": "https://www.reuters.com/business/healthcare-pharmaceuticals/health-rounds-ai-tops-surgeons-writing-post-operative-reports-2025-02-14/?utm_source=openai",
+ "title": "Health Rounds: AI tops surgeons in writing post-operative reports",
+ "start_index": 4401,
+ "end_index": 4621
+ }
+ ]
+ },
+ {
+ "answer": "Between 2020 and 2025, artificial intelligence (AI) has significantly advanced diagnostic imaging and predictive analytics, enhancing disease detection, treatment planning, and patient outcomes.\n\n**Advancements in AI for Diagnostic Imaging:**\n\n1. **Enhanced Image Interpretation:** AI algorithms, particularly deep learning models, have improved the accuracy and speed of interpreting medical images. For instance, convolutional neural networks (CNNs) now achieve diagnostic accuracy comparable to senior radiologists for specific pathologies, such as detecting lung nodules and breast cancer lesions. ([forbes.com](https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai))\n\n2. **Real-Time Imaging and Image Fusion:** AI has facilitated real-time imaging techniques and image fusion, allowing for dynamic visualization of physiological processes. This includes advancements in 4D imaging, capturing moving structures like blood flow patterns through cardiac cycles, and hybrid imaging modalities like PET-MRI fusion, enhancing tumor metabolism assessment and anatomical mapping. ([blog.medicai.io](https://blog.medicai.io/en/future-of-medical-imaging/?utm_source=openai))\n\n3. **Automated Image Analysis:** AI-driven tools have automated the analysis of medical images, reducing radiologists' workload and improving diagnostic consistency. For example, AI systems can prioritize urgent cases by detecting critical findings in imaging studies, leading to faster intervention. ([forbes.com](https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai))\n\n4. **Improved Imaging Techniques:** AI has enhanced imaging techniques by reducing noise and improving resolution, resulting in clearer images with lower radiation doses. This is particularly beneficial in modalities like low-dose CT and fast MRI, where traditional methods faced challenges with image quality. ([en.wikipedia.org](https://en.wikipedia.org/wiki/Deep_Tomographic_Reconstruction?utm_source=openai))\n\n**Advancements in AI for Predictive Analytics:**\n\n1. **Early Disease Detection:** AI models have been developed to predict disease progression by analyzing patterns in imaging data. For instance, machine learning algorithms can forecast multiple sclerosis progression with high accuracy months in advance, enabling early intervention. ([blog.medicai.io](https://blog.medicai.io/en/future-of-medical-imaging/?utm_source=openai))\n\n2. **Personalized Treatment Planning:** AI has been instrumental in developing personalized treatment plans by analyzing patient-specific data. In oncology, AI systems assess tumor characteristics and predict responses to therapies, facilitating tailored treatment strategies. ([forbes.com](https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai))\n\n3. **Risk Prediction Models:** AI-driven predictive models analyze various data sources, including imaging and clinical records, to identify patients at risk of adverse events like strokes or heart attacks. This proactive approach allows for timely preventive measures. ([time.com](https://time.com/6227623/ai-medical-imaging-radiology/?utm_source=openai))\n\n4. **Integration with Electronic Health Records (EHRs):** AI systems have been integrated with EHRs to analyze large datasets, identifying patterns and predicting patient outcomes. This integration supports clinical decision-making and enhances patient care by providing comprehensive insights. ([pmc.ncbi.nlm.nih.gov](https://pmc.ncbi.nlm.nih.gov/articles/PMC11799571/?utm_source=openai))\n\nThese advancements underscore AI's transformative role in diagnostic imaging and predictive analytics, leading to more accurate diagnoses, personalized treatments, and improved patient outcomes. ",
+ "citations": [
+ {
+ "url": "https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai",
+ "title": "AI-Driven Medical Imaging: Revolutionizing Diagnostics And Treatment",
+ "start_index": 602,
+ "end_index": 765
+ },
+ {
+ "url": "https://blog.medicai.io/en/future-of-medical-imaging/?utm_source=openai",
+ "title": "Future of Medical Imaging in 2025",
+ "start_index": 1171,
+ "end_index": 1263
+ },
+ {
+ "url": "https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai",
+ "title": "AI-Driven Medical Imaging: Revolutionizing Diagnostics And Treatment",
+ "start_index": 1566,
+ "end_index": 1729
+ },
+ {
+ "url": "https://en.wikipedia.org/wiki/Deep_Tomographic_Reconstruction?utm_source=openai",
+ "title": "Deep Tomographic Reconstruction",
+ "start_index": 2042,
+ "end_index": 2143
+ },
+ {
+ "url": "https://blog.medicai.io/en/future-of-medical-imaging/?utm_source=openai",
+ "title": "Future of Medical Imaging in 2025",
+ "start_index": 2480,
+ "end_index": 2572
+ },
+ {
+ "url": "https://www.forbes.com/councils/forbestechcouncil/2025/03/11/ai-driven-medical-imaging-revolutionizing-diagnostics-and-treatment/?utm_source=openai",
+ "title": "AI-Driven Medical Imaging: Revolutionizing Diagnostics And Treatment",
+ "start_index": 2851,
+ "end_index": 3014
+ },
+ {
+ "url": "https://time.com/6227623/ai-medical-imaging-radiology/?utm_source=openai",
+ "title": "How AI Is Changing Medical Imaging to Improve Patient Care",
+ "start_index": 3286,
+ "end_index": 3372
+ },
+ {
+ "url": "https://pmc.ncbi.nlm.nih.gov/articles/PMC11799571/?utm_source=openai",
+ "title": "Use of AI in Diagnostic Imaging and Future Prospects - PMC",
+ "start_index": 3669,
+ "end_index": 3763
+ }
+ ]
+ },
+ {
+ "answer": "Artificial intelligence (AI) is increasingly transforming healthcare by enhancing diagnostic accuracy, streamlining operations, and improving patient outcomes. Below are several impactful AI case studies in healthcare, followed by an analysis of market adoption trends as of 2025.\n\n**Impactful AI Case Studies in Healthcare**\n\n1. **Apollo Hospitals' AI Integration in India**\n\n Apollo Hospitals, one of India's largest healthcare providers, has significantly invested in AI to alleviate the workload of medical staff. By automating routine tasks such as medical documentation, the hospital aims to free up two to three hours daily for doctors and nurses. The AI tools assist with patient diagnoses, test recommendations, treatment suggestions, and transcription of doctors' notes. Additionally, Apollo is developing an AI system to prescribe the most effective antibiotics, addressing challenges like high nurse attrition rates and plans to expand bed capacity by one-third over four years. ([reuters.com](https://www.reuters.com/business/healthcare-pharmaceuticals/indias-apollo-hospitals-bets-ai-tackle-staff-workload-2025-03-13/?utm_source=openai))\n\n2. **University of Pittsburgh and Leidos Collaboration**\n\n The University of Pittsburgh (Pitt) partnered with Leidos in a $10 million, five-year initiative to combat cancer and heart disease using AI, focusing on underserved communities. Leveraging Pitt's Computational Pathology and AI Center of Excellence (CPACE), the collaboration has developed AI tools that enhance diagnostic speed and accuracy. For instance, generative AI applications have expedited leukemia reporting, reducing errors and alleviating pressures from staffing shortages. The initiative emphasizes ethical AI implementation with continuous human oversight. ([axios.com](https://www.axios.com/local/pittsburgh/2025/04/18/pitt-leidos-use-ai-to-fight-cancer-and-health-disparities?utm_source=openai))\n\n3. **C2-Ai's AI-Powered Surgical Support**\n\n UK-based company C2-Ai developed an AI system to assist patients during long waits for surgery, improving outcomes and reducing healthcare costs. The technology assesses individual patient risks using a dataset of approximately 500 million global patient cases. Patients receive guidance on diet, exercise, and mental health support through applications like Surgery Hero. This proactive approach has led to a sixfold decrease in complications and halved readmission rates among about 2,000 patients in Cheshire and Merseyside. The technology is also being adopted in countries like Canada, Italy, and Sweden. ([ft.com](https://www.ft.com/content/37b79af4-116f-46e5-9bbd-b814aa4c95af?utm_source=openai))\n\n4. **Mercy's Integration of Aidoc's AI Platform**\n\n In February 2025, Mercy, a healthcare organization, began integrating Aidoc’s AI-driven aiOS platform into its imaging services to enhance speed and accuracy in patient care. This initiative is part of Mercy's broader strategy to incorporate AI into clinical workflows, aiming to improve diagnostic efficiency and patient outcomes. ([en.wikipedia.org](https://en.wikipedia.org/wiki/Aidoc?utm_source=openai))\n\n5. **Heidi Health's AI Medical Scribe**\n\n Australian company Heidi Health provides AI-based medical scribe software that automates clinical documentation for healthcare professionals. The software transcribes patient consultations into clinical notes, case histories, and other medical documents, reducing administrative burdens and allowing clinicians to focus more on patient care. As of 2025, Heidi Health supports over one million patient interactions per week across multiple countries. ([en.wikipedia.org](https://en.wikipedia.org/wiki/Heidi_Health?utm_source=openai))\n\n**Market Adoption Analysis as of 2025**\n\nThe AI in healthcare market has experienced substantial growth, driven by technological advancements and increasing demand for efficient healthcare solutions. Key trends include:\n\n- **Market Growth**: The global AI in healthcare market is projected to grow from USD 39.34 billion in 2025 to USD 490.96 billion by 2032, exhibiting a compound annual growth rate (CAGR) of 43.4%. ([fortunebusinessinsights.com](https://www.fortunebusinessinsights.com/industry-reports/artificial-intelligence-in-healthcare-market-100534?utm_source=openai))\n\n- **Investment Surge**: In the first two quarters of 2024, total investments in AI-driven healthcare startups surpassed USD 35 billion. Notable examples include Abridge securing USD 150 million for ambient clinical documentation tools and AKASA raising USD 120 million to enhance revenue cycle automation. ([futuremarketinsights.com](https://www.futuremarketinsights.com/reports/artificial-intelligence-in-healthcare-market?utm_source=openai))\n\n- **Technological Innovations**: AI is being integrated into various healthcare applications, such as AI-driven drug discovery, personalized medicine, augmented reality in surgery, and AI-powered genome sequencing. These innovations are driving efficiency, improving patient outcomes, and transforming healthcare delivery models. ([pharmiweb.com](https://www.pharmiweb.com/press-release/2025-02-14/artificial-intelligence-in-healthcare-market-2024-2035-trends-competitive-landscape-and-future-outlook?utm_source=openai))\n\n- **Regulatory and Ethical Considerations**: The widespread adoption of AI in healthcare raises critical regulatory and ethical challenges, particularly regarding accountability in AI-assisted diagnosis and the risk of automation bias. The absence of a well-defined liability framework underscores the need for policies that ensure AI functions as an assistive tool rather than an autonomous decision-maker. ([arxiv.org](https://arxiv.org/abs/2502.16732?utm_source=openai))\n\nIn summary, AI is making significant strides in healthcare, with numerous case studies demonstrating its potential to enhance patient care and operational efficiency. The market is poised for continued growth, driven by technological advancements and substantial investments. However, addressing regulatory and ethical challenges remains crucial to ensure responsible and effective AI integration in healthcare. ",
+ "citations": [
+ {
+ "url": "https://www.reuters.com/business/healthcare-pharmaceuticals/indias-apollo-hospitals-bets-ai-tackle-staff-workload-2025-03-13/?utm_source=openai",
+ "title": "India's Apollo Hospitals bets on AI to tackle staff workload",
+ "start_index": 993,
+ "end_index": 1153
+ },
+ {
+ "url": "https://www.axios.com/local/pittsburgh/2025/04/18/pitt-leidos-use-ai-to-fight-cancer-and-health-disparities?utm_source=openai",
+ "title": "Pitt, Leidos use AI to fight cancer and health disparities",
+ "start_index": 1787,
+ "end_index": 1927
+ },
+ {
+ "url": "https://www.ft.com/content/37b79af4-116f-46e5-9bbd-b814aa4c95af?utm_source=openai",
+ "title": "AI generated advice eases long waits for surgery",
+ "start_index": 2586,
+ "end_index": 2679
+ },
+ {
+ "url": "https://en.wikipedia.org/wiki/Aidoc?utm_source=openai",
+ "title": "Aidoc",
+ "start_index": 3067,
+ "end_index": 3142
+ },
+ {
+ "url": "https://en.wikipedia.org/wiki/Heidi_Health?utm_source=openai",
+ "title": "Heidi Health",
+ "start_index": 3638,
+ "end_index": 3720
+ },
+ {
+ "url": "https://www.fortunebusinessinsights.com/industry-reports/artificial-intelligence-in-healthcare-market-100534?utm_source=openai",
+ "title": "Artificial Intelligence [AI] in Healthcare Market Size | Share, 2032",
+ "start_index": 4140,
+ "end_index": 4299
+ },
+ {
+ "url": "https://www.futuremarketinsights.com/reports/artificial-intelligence-in-healthcare-market?utm_source=openai",
+ "title": "AI in Healthcare Market Size, Trends & Forecast 2025-2035",
+ "start_index": 4607,
+ "end_index": 4744
+ },
+ {
+ "url": "https://www.pharmiweb.com/press-release/2025-02-14/artificial-intelligence-in-healthcare-market-2024-2035-trends-competitive-landscape-and-future-outlook?utm_source=openai",
+ "title": "Artificial Intelligence in Healthcare Market [2024-2035]: Trends, Competitive Landscape, and Future Outlook - PharmiWeb.com",
+ "start_index": 5076,
+ "end_index": 5266
+ },
+ {
+ "url": "https://arxiv.org/abs/2502.16732?utm_source=openai",
+ "title": "DeepSeek reshaping healthcare in China's tertiary hospitals",
+ "start_index": 5676,
+ "end_index": 5741
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/examples/agents_sdk/web_search.py b/examples/agents_sdk/web_search.py
new file mode 100644
index 0000000000..4e5cfd7954
--- /dev/null
+++ b/examples/agents_sdk/web_search.py
@@ -0,0 +1,11 @@
+from openai import OpenAI
+client = OpenAI()
+
+response = client.responses.create(
+ model="gpt-4.1",
+ tools=[{"type": "web_search_preview", "search_context_size": "high",}],
+ input="Impact of telematics and AI in auto insurance 2025"
+)
+
+import json
+print(json.dumps(response.model_dump(), indent=2))
\ No newline at end of file