LLMQuant / LLMQuant/quant-mind

[Feature] flow: Agentic LLMFlow Middleware for Dynamic Tool-Driven Reasoning

Open
#63 1 comment 0 reactions 1 assignee View on GitHub

@keli-wen is already working on this.

Since Sep 15, 2025.

area: flows stale type: feature
Dominant language
Python
Stars
3k
Forks
484
PR merge metrics
No merged PRs in 30d

Description

✨ Feature Summary

Introduce a new LLMFlow class: an agentic runtime that leverages LLMs for dynamic, tool-driven reasoning within QuantMind. This will allow the framework to autonomously plan and execute multi-step financial analysis tasks by orchestrating tools in response to user input, inspired by modern agent design patterns.

We will primarily take smolagents repo as base to develop our LLMFlow.

🎯 Motivation

The current BaseFlow supports only statically orchestrated task flows, limiting the framework's ability to respond adaptively to user goals or leverage external capabilities. By adding LLMFlow, QuantMind can:

  • Dynamically select and use tools based on LLM-driven reasoning
  • Support autonomous, multi-step task execution (e.g., query data, analyze, compare, summarize)
  • Integrate tightly with the agentic ecosystem, including future third-party or open-source toolkits

📋 Detailed Description

LLMFlow will:

  • Operate in an agentic loop, maintaining structured message history (not just a string scratchpad)
  • Delegate action planning to the LLM, which returns either a final answer or a list of tool calls
  • Execute tool calls asynchronously and append their results to the history for further reasoning
  • Support configuration via LLMFlowConfig, specifying the reasoning LLM and the set of available tools (as BaseTool instances)

🔧 Proposed Implementation

  • Add LLMFlowConfig (in quantmind/config/flows.py) to specify the reasoning LLM and available tools
  • Implement LLMFlow (in quantmind/flows/llm_flow.py), following agent middleware patterns:
    • Asynchronous reasoning loop with structured message history
    • Tool call schema generation and execution via native LLM APIs
    • Clear error handling and extensibility for new tool types
  • Provide usage and extension documentation
API Design
# quantmind/config/flows.py
class LLMFlowConfig(BaseFlowConfig):
    reasoning_llm_identifier: str
    tools: List[BaseTool]

# quantmind/flows/llm_flow.py
class LLMFlow(BaseFlow):
    async def run(self, initial_input: str, max_iterations: int = 5) -> Any:
        ...
Configuration
llmflow:
  reasoning_llm_identifier: "gpt-4-turbo"
  tools:
    - name: "company_financials"
    - name: "data_fetcher"

🎨 User Experience

Users can define a flow that reasons and acts using LLMs and a configurable set of tools. Complex tasks like “Summarize this report and compare key metrics with last quarter” become possible with minimal code changes.

📊 Use Cases

  1. Automated Report Analysis: Fetch, analyze, and summarize financial reports using multiple tools in sequence, determined at runtime.
  2. Conversational Data Exploration: Users ask natural language queries, and the agent dynamically selects tools to pull, process, and present data.
  3. Third-Party Tool Integration: Easily plug in new tools (e.g., external APIs) for domain-specific analytics.

🔗 Related Issues

  • Relates to #47 (BaseTool design and implementation)

Implementation Considerations

Breaking Changes
  • This feature would introduce breaking changes
  • This feature is backward compatible
Dependencies
  • Requires new dependencies
  • Uses existing dependencies only

Checklist

  • I have searched existing issues to avoid duplicates
  • I have provided a clear and detailed description
  • I have explained the motivation and use cases
  • I have considered the implementation approach
  • I have thought about potential breaking changes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.