PyDxAI AI Agentic Intelligence.. From structured queries to autonomous reasoning

PyDxAI Agentic Intelligence — November 8, 2025 Progress Report

“From structured queries to autonomous reasoning — today PyDxAI learned how to think, not just answer.”

The development of PyDxAI continues to accelerate. What began as a diagnostic reasoning framework has now grown into an agentic intelligence system capable of adaptive reasoning, contextual learning, and safe decision-making in real clinical environments. The latest milestone, achieved on November 8, 2025, represents a leap forward in how the system processes, understands, and refines human language — marking the beginning of a truly autonomous medical AI workflow.


1. The New Foundation: FrontLLM and App3 Sharpened Query

At the heart of today’s progress lies the new FrontLLM preprocessing layer, enhanced with a linguistic cleaner called [App3].
Previously, queries often contained duplication or contextual noise (e.g., “User: … User asks: …”), which degraded retrieval precision. Now, the system automatically sharpened and normalized user input before any retrieval or reasoning steps occur.

Example:

User: Any hormone replacement is better than estrogen?
User asks: Any hormone replacement is better than estrogen?

is now intelligently reduced to:

Cleaned query = Any hormone replacement is better than estrogen?

This simple transformation dramatically improved retriever accuracy, embedding efficiency, and LLM focus, making PyDxAI more responsive and semantically consistent. It also allowed the agent to run cleanly through each reasoning layer without generating redundant embeddings.

2. Triple Memory Architecture in Action

The PyDxAI system now operates with a Triple Memory Framework:

  1. Session Memory — for short-term dialogue coherence
  2. Global Memory — for persistent medical knowledge
  3. Novelty Detector Memory — for identifying new or rare inputs that may require learning or external lookup

During the hormone replacement test case, the system automatically recognized that no prior context existed, retrieved relevant documents from Harrison’s Principles of Internal Medicine 2025, and synthesized a contextual explanation about estrogen therapy and progestin interactions — all while logging each memory segment for potential reuse.

By cleanly separating memory types, PyDxAI can think across sessions yet maintain strict context isolation, a crucial property for safety in medical applications.


3. Autonomic Web Fallback and Discovery Layer

Today marked the first full success of the automatic web discovery system, which activates when the model encounters unknown or misspelled medical terms.

In the query:

Suggest me fghtsumab medicines?

PyDxAI correctly detected “fghtsumab” as an unknown entity and triggered an external search. The engine accessed multiple providers (Brave and Yahoo) and gracefully handled DNS errors from Wikipedia, returning structured summaries to the RAG (Retrieval-Augmented Generation) layer.

Instead of hallucinating a nonexistent drug, PyDxAI generated a cautious and responsible answer:

“The term ‘fghtsumab’ appears to be a typographical error. If you meant a monoclonal antibody such as efgartigimod or belimumab, please clarify.”

This is an example of agentic reasoning — the model not only recognized uncertainty but actively sought clarification while maintaining medical accuracy and safety.


4. Unified RAG + Promptbook Integration

The Retrieval-Augmented Generation (RAG) system now seamlessly integrates local medical knowledge with real-time web data, structured through the new Promptbook template.
Every request follows a clearly defined format:

  • System Rules: Safety, accuracy, and bilingual medical compliance
  • Memory Context: Session and global recall
  • RAG Context: Local documents + web snippets
  • Question → Answer Pair: Precise alignment for the LLM

This architecture ensures that PyDxAI operates like a clinical reasoning engine rather than a simple chatbot. Each answer is based on retrieved evidence, then refined by a reasoning model (currently powered by Mistral-Q4_K_M and DeepSeek R1 13B Qwen for dual-LLM reasoning).


5. Advanced Logging and Explainability

For every query, the backend now records:

  • Retriever sources and document previews
  • Embedding vector shapes and lengths
  • Novelty detection results
  • Web-fallback status
  • Memory saving confirmation (session + global)

An example log snippet:

📚 Retrieved 3 context docs for query='Any hormone replacement is better than estrogen?'
🧩 Novelty check: max_sim=0.78, threshold=0.70
✅ Memory saved id=188  scope=session  summary=Any hormone replacement is better than estrogen?

This transparency enables full traceability — every AI conclusion can be audited from query to answer, an essential step toward clinical-grade safety.


6. Agentic Behavior Emerging

The day’s most significant observation was not a line of code, but a behavior.

When faced with an uncertain input, PyDxAI didn’t simply fail — it adapted:

  • Detected an unknown token
  • Triggered self-correction via search
  • Retrieved new knowledge
  • Formulated a probabilistic hypothesis
  • Requested user clarification

This is the essence of agentic AI — systems that can act, reason, and reflect.
PyDxAI now shows early signs of autonomy, capable of self-repairing its understanding pipeline and making informed decisions about when to seek external data.


7. What’s Next

The roadmap from today’s success includes:

  1. Auto-embedding repair patch — to handle vector shape mismatches seamlessly
  2. Feedback-based self-learning loop — where user or model feedback refines memory entries
  3. Contextual Safety Layer (CSL) — to detect high-risk clinical terms and enforce cautionary responses
  4. MIRAI Integration — bridging PyDxAI with the MIRAI intelligence network for continuous medical knowledge evolution

Together, these will complete the Autonomous Medical Reasoning Core, turning PyDxAI from a reactive tool into a continuously learning assistant.


8. Summary: A New Cognitive Milestone

Today’s session marked a quiet but profound milestone:
PyDxAI is no longer just a retrieval-based system — it has begun to reason like a clinician.

It interprets unclear questions, searches intelligently, and formulates context-aware, evidence-based responses. The logs show not just computations, but cognition — a structured process of perception, analysis, and adaptation.

Each layer, from query sharpening to RAG synthesis, now contributes to a unified intelligence loop — the same cognitive pattern that defines human problem-solving. With these capabilities, PyDxAI stands closer than ever to its mission:
to become the safest, most intelligent, and most transparent diagnostic AI system built for medicine.

PyDxAI Achieves Successful Agentic RAG Integration with Intelligent Search Intent

Today marks a major breakthrough in the development of PyDxAI, our agentic medical knowledge system designed to combine reasoning, retrieval, and autonomous learning. After weeks of refinement, debugging, and optimization, the system has achieved a fully functional Agentic Retrieval-Augmented Generation (RAG) workflow — now capable of dynamically detecting search intent, fetching relevant documents, and integrating live web search results into coherent medical summaries.

This successful test represents a key step toward building a self-sustaining, reasoning-driven AI that learns continuously from medical data, guidelines, and real-world context.

🧠 What Is Agentic RAG?

In traditional RAG systems, the model retrieves information from a static database and integrates it with an LLM’s reasoning before generating a final answer. However, the Agentic RAG framework extends this concept. It adds decision-making ability — allowing the AI to determine when to search, what to retrieve, and how to combine contextual knowledge from multiple layers of memory and web data.

PyDxAI’s agentic structure includes:

  • FrontLLM: The conversational reasoning engine that analyzes user queries.
  • Triple Memory System: A structured memory composed of short-term chat history, session memory, and global medical knowledge.
  • Retriever Layer: A hybrid retriever that connects to Qdrant for vector search and to external search engines like Bing, Brave, or PubMed when local results are insufficient.
  • PromptBook Engine: A YAML-based modular prompt system that defines domain roles, reasoning modes, and fallback prompts.

With these components working together, the system can perform autonomous query refinement, retrieve both local and web data, and generate concise, evidence-based medical responses — all without manual supervision.


🔍 The Test Case: “Search for COVID Vaccine Adverse Effects”

To evaluate the integrated system, a real-world query was chosen:

“Search for COVID vaccine adverse effects.”

This test was ideal because it requires multi-source synthesis — combining current scientific understanding with structured clinical data from guidelines and textbooks.

Here’s how the system performed step-by-step:

  1. Query Sharpening:
    The front LLM refined the user query automatically:
    Sharpened query: “COVID vaccine adverse effects.”
  2. Retriever Activation:
    The system selected the VectorStoreRetriever and fetched three context documents from the local Qdrant database, including excerpts from:
    • NIH COVID-19 Treatment Guidelines (2025)
    • CURRENT Medical Diagnosis and Treatment (2022)
    • Harrison’s Principles of Internal Medicine (2025)
  3. Intent Recognition:
    The agent analyzed the query and flagged it as a search-type intent (verified by the second check).
    It then forced a web search, querying multiple sources (Wikipedia, Bing, Brave, etc.) to ensure up-to-date information.
  4. Web Integration:
    The system retrieved five live results from the web, merged them with internal medical data, and produced a unified summary emphasizing both safety and rare adverse events associated with COVID-19 vaccines.
  5. Memory Consolidation:
    After generating the answer, the session’s memory and embeddings were automatically saved into both the chat history and the global memory.
    Although a JSON syntax error occurred in one field (invalid input syntax for type json), the overall memory write was successful — confirming both redundancy and resilience of the data-saving mechanism.

🧩 The Output: Medical-Grade Summary

The generated response was not only accurate but also aligned with current clinical evidence:

“COVID-19 vaccines are generally safe and effective, but like any medical intervention, they can have side effects. Common local reactions include pain, redness, and swelling at the injection site. Systemic symptoms such as fever, fatigue, and headache may occur. Rare events include anaphylaxis, thrombosis, and myocarditis, particularly in young males after mRNA vaccines. Most side effects are mild and self-limited.”

The response also provided references (CDC and PubMed Central), reflecting the system’s ability to automatically cite reputable medical sources — a core requirement for responsible AI in healthcare.


⚙️ Technical Milestones

Key success points from today’s implementation:

  • Search Intent Detection: Correctly classified and triggered web search mode.
  • RAG Document Retrieval: Retrieved 3 relevant documents from local vector database.
  • Web Context Fusion: Combined local and external results seamlessly.
  • Memory Update System: Stored new knowledge entries into both session and global memory tables.
  • Autonomous Reasoning: Generated coherent, medically consistent summary without explicit instructions.

The only remaining issue was a minor JSON formatting bug during memory insertion ({web_search...} token not enclosed in quotes). This is a simple fix — ensuring all metadata keys are stringified before passing to PostgreSQL/MariaDB insertion.


🧭 Why This Matters

This milestone proves that PyDxAI is evolving beyond a static chatbot or RAG prototype. It’s becoming an autonomous medical reasoning system — capable of:

  • Recognizing when it doesn’t know an answer.
  • Searching intelligently using real-time data sources.
  • Integrating retrieved evidence into structured medical responses.
  • Learning continuously through memory reinforcement.

Such a system lays the foundation for a next-generation AI medical assistant that can stay current with rapidly evolving clinical knowledge, from new antiviral drugs to emerging vaccine data.


🌐 The Road Ahead

Next steps for PyDxAI development include:

  1. Fix JSON encoding during memory saving.
  2. Enhance confidence scoring between local vs. web-sourced data.
  3. Add summarization weighting — giving higher priority to peer-reviewed medical documents.
  4. Integrate PubMed API retrieval for direct evidence-based references.
  5. Enable agentic self-evaluation, where the system critiques and improves its own answers based on retrieved context.

With these improvements, PyDxAI will approach a truly autonomous agentic medical knowledge engine, bridging the gap between AI reasoning and clinical reliability.


In summary, today’s success demonstrates that PyDxAI’s Agentic RAG pipeline — equipped with reasoning, retrieval, and adaptive learning — can now perform as a self-sufficient intelligent assistant for medical knowledge exploration.

Each successful query brings it one step closer to the vision of MIRAI, the evolving AI ecosystem for autonomous, evidence-based medical reasoning.