feat: implement multi-hop pathway traversal for deeper mechanistic reasoning#153
Open
bhavyakeerthi3 wants to merge 7 commits intoreactome:mainfrom
Open
feat: implement multi-hop pathway traversal for deeper mechanistic reasoning#153bhavyakeerthi3 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.
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.
Fixes #152
Description
This PR implements recursive traversal in
ReactomeTopologyTool. Previously the tool fetched only immediate local context direct inputs, outputs, and one level of preceding events. This enhancement allows the agent to follow both causal and hierarchical links recursively, providing significantly deeper mechanistic context.Changes
get_flow_contextto follow multi-step hops through the Reactome graphhasEvent(Pathway → Sub-segment) andprecedingEvent(Reaction → Upstream trigger)max_depth=2default with per-level breadth cap of 3 events — balances context richness against LLM window limitsImpact
The agent can now answer complex process-oriented queries like "What triggers this cascade?" by tracing causal flow across multiple hops in the Reactome pathway network — rather than seeing only the immediate reaction context.
Verification
R-HSA-109581) correctly expanded into sub-pathwaysR-HSA-111452Files Affected
src/tools/reactome_topology.pytests/test_flow_reasoning.py