Skip to content

feat: implement multi-hop pathway traversal for deeper mechanistic reasoning #152

@bhavyakeerthi3

Description

@bhavyakeerthi3

Problem

ReactomeTopologyTool provides only immediate "local" context for any given reaction — direct inputs, outputs, and direct preceding events. For complex mechanistic queries (e.g., "What is the ultimate trigger for Apoptosis through this specific cascade?"), the agent lacks the ability to look further back into causal chains.

This "tunnel vision" limits reasoning quality, as many biological questions require traversing several steps to answer correctly.

Proposed Enhancement

Extend ReactomeTopologyTool to support recursive multi-hop traversal.

Key Requirements

  1. Upstream Traversal: Follow precedingEvent links recursively to establish causal history (A ← B ← C).
  2. Hierarchical Traversal: Explore hasEvent relationships for Pathway objects to find sub-pathways and specific reactions.
  3. Safety & Token Management:
    • Cycle detection to avoid infinite loops in circular pathway structures
    • Configurable max_depth (default=2) to balance data richness against LLM context window limits
    • Breadth limiting to cap events fetched per level

Impact

Provides the flow reasoner with a complete causal process map instead of isolated reactions — directly improving answer quality for mechanistic queries like "What happens after X?" or "What triggers Y?"

Files Affected

  • src/tools/reactome_topology.py
  • tests/test_flow_reasoning.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions