To achieve all of MediPulse’s goals, Taazaa built a LangGraph ReAct agent—the Reasoning and Acting pattern where the AI observes the result of each step and decides its next action.
The agent selects from available tools and retrieves documents using a three-level hierarchical RAG system (global policies, tenant-specific policies, and site-specific policies), with strict priority resolution that ensures a site-level policy always overrides a global default.
The retrieval mechanism itself is two-stage. Utilizing AWS Bedrock Titan embeddings and pgvector, a hybrid vector-plus-keyword search retrieves the top 50 candidate passages. A cross-encoder reranker then narrows the results to the top two most relevant passages.
This two-stage approach eliminates a well-known failure mode: pure vector search can return passages that are semantically similar to the query but factually incorrect for the specific context.
An Agentic Decision Loop
What makes the system genuinely agentic is the decision loop. The agent does not follow a predetermined path. It evaluates retrieval quality, reformulates queries when results are insufficient, and maintains per-user semantic memory via Langmem backed by pgvector.
In practical terms, it means that the AI’s response to a follow-up question correctly inherits the context of the original query. For example, asking, “What is the protocol for patient discharge after cardiac surgery?” and following it up with, “What about for pediatric patients?” correctly inherits the cardiac discharge context without the user having to restate it. Input classification runs asynchronously in parallel for analytics, ensuring the reasoning loop is not bottlenecked by secondary processing.
This is a prime example of an agentic architecture. The problem space is open-ended, the retrieval targets are heterogeneous, the quality of any single retrieval step is unpredictable, and the system must reason about adequacy before responding. A deterministic pipeline would either return incorrect answers to complex queries or require so many hardcoded branches that it would become unmaintainable.