feat: add topological flow reasoning for mechanistic queries#144
Open
bhavyakeerthi3 wants to merge 7 commits intoreactome:mainfrom
Open
feat: add topological flow reasoning for mechanistic queries#144bhavyakeerthi3 wants to merge 7 commits intoreactome:mainfrom
bhavyakeerthi3 wants to merge 7 commits intoreactome:mainfrom
Conversation
…y data between nodes Without this field, LangGraph silently drops the topology data returned by identify_flow() before verify_mechanism() can read it, making the entire topological flow reasoning feature a no-op in production. Also adds a regression test (test_flow_context_in_state) to ensure the field is never accidentally removed.
9bef654 to
e0457c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Topological Flow Reasoning to handle mechanistic biological queries (e.g. "What happens after protein phosphorylation?") that standard RAG cannot answer correctly.
Fixes #143
Motivation
RAG retrieval returns keyword-matched snippets with no awareness of reaction ordering. Biological pathways have strict causal sequences — a hallucinated causal chain is worse than no answer because it sounds authoritative. This PR makes the agent verify causal claims against the Reactome Graph before responding.
Key Changes
src/tools/reactome_topology.pysrc/agent/tasks/flow_reasoner.pysrc/agent/profiles/cross_database.pyidentify_flowandverify_mechanismnodes to agent graphtests/test_flow_reasoning.pyHow It Works
Resilience
Added import fallbacks for
AttributeInfoto handle varied LangChain environments without breaking existing functionality.Test Results
Relation to Other PRs
flow_contextgathered here provides the exact evidence needed for faithfulness grading on mechanistic sequences