Integrations
Supports configuration through environment variables, allowing secure storage of API keys for external services like DeepSeek and Exa.
Enables robust data validation for thought steps in the sequential thinking process, ensuring input integrity before processing by the agent team.
Leverages the Python AI/ML ecosystem for implementing the Multi-Agent System architecture, supporting advanced sequential thinking capabilities.
Sequential Thinking Multi-Agent System (MAS)
English | 简体中文
This project implements an advanced sequential thinking process using a Multi-Agent System (MAS) built with the Agno framework and served via MCP. It represents a significant evolution from simpler state-tracking approaches by leveraging coordinated, specialized agents for deeper analysis and problem decomposition.
Overview
This server provides a sophisticated sequentialthinking
tool designed for complex problem-solving. Unlike its predecessor, this version utilizes a true Multi-Agent System (MAS) architecture where:
- A Coordinating Agent (the
Team
object incoordinate
mode) manages the workflow. - Specialized Agents (Planner, Researcher, Analyzer, Critic, Synthesizer) handle specific sub-tasks based on their defined roles and expertise.
- Incoming thoughts are actively processed, analyzed, and synthesized by the agent team, not just logged.
- The system supports complex thought patterns, including revisions of previous steps and branching to explore alternative paths.
- Integration with external tools like Exa (via the Researcher agent) allows for dynamic information gathering.
- Robust Pydantic validation ensures data integrity for thought steps.
- Detailed logging tracks the process, including agent interactions (handled by the coordinator).
The goal is to achieve a higher quality of analysis and a more nuanced thinking process than possible with a single agent or simple state tracking by harnessing the power of specialized roles working collaboratively.
Key Differences from Original Version (TypeScript)
This Python/Agno implementation marks a fundamental shift from the original TypeScript version:
Feature/Aspect | Python/Agno Version (Current) | TypeScript Version (Original) |
---|---|---|
Architecture | Multi-Agent System (MAS); Active processing by a team of agents. | Single Class State Tracker; Simple logging/storing. |
Intelligence | Distributed Agent Logic; Embedded in specialized agents & Coordinator. | External LLM Only; No internal intelligence. |
Processing | Active Analysis & Synthesis; Agents act on the thought. | Passive Logging; Merely recorded the thought. |
Frameworks | Agno (MAS) + FastMCP (Server); Uses dedicated MAS library. | MCP SDK only. |
Coordination | Explicit Team Coordination Logic (Team in coordinate mode). | None; No coordination concept. |
Validation | Pydantic Schema Validation; Robust data validation. | Basic Type Checks; Less reliable. |
External Tools | Integrated (Exa via Researcher); Can perform research tasks. | None. |
Logging | Structured Python Logging (File + Console); Configurable. | Console Logging with Chalk; Basic. |
Language & Ecosystem | Python; Leverages Python AI/ML ecosystem. | TypeScript/Node.js. |
In essence, the system evolved from a passive thought recorder to an active thought processor powered by a collaborative team of AI agents.
How it Works (Coordinate Mode)
- Initiation: An external LLM uses the
sequential-thinking-starter
prompt to define the problem and initiate the process. - Tool Call: The LLM calls the
sequentialthinking
tool with the first (or subsequent) thought, structured according to theThoughtData
Pydantic model. - Validation & Logging: The tool receives the call, validates the input using Pydantic, logs the incoming thought, and updates the history/branch state via
AppContext
. - Coordinator Invocation: The core thought content (along with context about revisions/branches) is passed to the
SequentialThinkingTeam
'sarun
method. - Coordinator Analysis & Delegation: The
Team
(acting as Coordinator) analyzes the input thought, breaks it down into sub-tasks, and delegates these sub-tasks to the most relevant specialist agents (e.g., Analyzer for analysis tasks, Researcher for information needs). - Specialist Execution: Delegated agents execute their specific sub-tasks using their instructions, models, and tools (like
ThinkingTools
orExaTools
). - Response Collection: Specialists return their results to the Coordinator.
- Synthesis & Guidance: The Coordinator synthesizes the specialists' responses into a single, cohesive output. This output may include recommendations for revision or branching based on the specialists' findings (especially from the Critic and Analyzer). It also provides guidance for the LLM on formulating the next thought.
- Return Value: The tool returns a JSON string containing the Coordinator's synthesized response, status, and updated context (branches, history length).
- Iteration: The calling LLM uses the Coordinator's response and guidance to formulate the next
sequentialthinking
tool call, potentially triggering revisions or branches as suggested.
Token Consumption Warning
⚠️ High Token Usage: Due to the Multi-Agent System architecture, this tool consumes significantly more tokens than single-agent alternatives or the previous TypeScript version. Each sequentialthinking
call invokes:
- The Coordinator agent (the
Team
itself). - Multiple specialist agents (potentially Planner, Researcher, Analyzer, Critic, Synthesizer, depending on the Coordinator's delegation).
This parallel processing leads to substantially higher token usage (potentially 3-6x or more per thought step) compared to single-agent or state-tracking approaches. Budget and plan accordingly. This tool prioritizes analysis depth and quality over token efficiency.
Prerequisites
- Python 3.10+
- Access to a compatible LLM API (configured for
agno
). The system currently supports:- Groq: Requires
GROQ_API_KEY
. - DeepSeek: Requires
DEEPSEEK_API_KEY
. - OpenRouter: Requires
OPENROUTER_API_KEY
. - Configure the desired provider using the
LLM_PROVIDER
environment variable (defaults todeepseek
).
- Groq: Requires
- Exa API Key (required only if using the Researcher agent's capabilities)
- Set via the
EXA_API_KEY
environment variable.
- Set via the
uv
package manager (recommended) orpip
.
MCP Server Configuration (Client-Side)
This server runs as a standard executable script that communicates via stdio, as expected by MCP. The exact configuration method depends on your specific MCP client implementation. Consult your client's documentation for details on integrating external tool servers.
The env
section within your MCP client configuration should include the API key for your chosen LLM_PROVIDER
.
Installation & Setup
Installing via Smithery
To install Sequential Thinking Multi-Agent System for Claude Desktop automatically via Smithery:
Manual Installation
- Clone the repository:Copy
- Set Environment Variables:
Create a
.env
file in the project root directory or export the variables directly into your environment:Note on Model Selection:Copy- The
TEAM_MODEL_ID
is used by the Coordinator (Team
object). This role benefits from strong reasoning, synthesis, and delegation capabilities. Consider using a more powerful model (e.g.,deepseek-chat
,claude-3-opus
,gpt-4-turbo
) here, potentially balancing capability with cost/speed. - The
AGENT_MODEL_ID
is used by the specialist agents (Planner, Researcher, etc.). These handle focused sub-tasks. A faster or more cost-effective model (e.g.,deepseek-chat
,claude-3-sonnet
,llama3-8b
) might be suitable, depending on task complexity and budget/performance needs. - Defaults are provided in the code (e.g., in
main.py
) if these environment variables are not set. Experimentation is encouraged to find the optimal balance for your use case.
- The
- Install Dependencies:
It's highly recommended to use a virtual environment.
- Using
uv
(Recommended):Copy - Using
pip
:Copy
- Using
Usage
Ensure your environment variables are set and the virtual environment (if used) is active.
Run the server. Choose one of the following methods:
- Using
uv run
(Recommended):Copy - Directly using Python:Copy
The server will start and listen for requests via stdio, making the sequentialthinking
tool available to compatible MCP clients configured to use it.
sequentialthinking
Tool Parameters
The tool expects arguments matching the ThoughtData
Pydantic model:
Interacting with the Tool (Conceptual Example)
An LLM would interact with this tool iteratively:
- LLM: Uses a starter prompt (like
sequential-thinking-starter
) with the problem definition. - LLM: Calls
sequentialthinking
tool withthoughtNumber: 1
, the initialthought
(e.g., "Plan the analysis..."), an estimatedtotalThoughts
, andnextThoughtNeeded: True
. - Server: MAS processes the thought. The Coordinator synthesizes responses from specialists and provides guidance (e.g., "Analysis plan complete. Suggest researching X next. No revisions recommended yet.").
- LLM: Receives the JSON response containing
coordinatorResponse
. - LLM: Formulates the next thought based on the
coordinatorResponse
(e.g., "Research X using available tools..."). - LLM: Calls
sequentialthinking
tool withthoughtNumber: 2
, the newthought
, potentially updatedtotalThoughts
,nextThoughtNeeded: True
. - Server: MAS processes. The Coordinator synthesizes (e.g., "Research complete. Findings suggest a flaw in thought #1's assumption. RECOMMENDATION: Revise thought #1...").
- LLM: Receives the response, notes the recommendation.
- LLM: Formulates a revision thought.
- LLM: Calls
sequentialthinking
tool withthoughtNumber: 3
, the revisionthought
,isRevision: True
,revisesThought: 1
,nextThoughtNeeded: True
. - ... and so on, potentially branching or extending the process as needed.
Tool Response Format
The tool returns a JSON string containing:
Logging
- Logs are written to
~/.sequential_thinking/logs/sequential_thinking.log
by default. (Configuration might be adjustable in the logging setup code). - Uses Python's standard
logging
module. - Includes a rotating file handler (e.g., 10MB limit, 5 backups) and a console handler (typically INFO level).
- Logs include timestamps, levels, logger names, and messages, including structured representations of thoughts being processed.
Development
- Clone the repository: (As in Installation)Copy
- Set up Virtual Environment: (Recommended)Copy
- Install Dependencies (including dev):
Ensure your
requirements-dev.txt
orpyproject.toml
specifies development tools (likepytest
,ruff
,black
,mypy
).Copy - Run Checks:
Execute linters, formatters, and tests (adjust commands based on your project setup).Copy
- Contribution: (Consider adding contribution guidelines: branching strategy, pull request process, code style).
License
MIT
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
An advanced MCP server that implements sophisticated sequential thinking using a coordinated team of specialized AI agents (Planner, Researcher, Analyzer, Critic, Synthesizer) to deeply analyze problems and provide high-quality, structured reasoning.
Related MCP Servers
- AsecurityAlicenseAqualityAn adaptation of the MCP Sequential Thinking Server designed to guide tool usage in problem-solving. This server helps break down complex problems into manageable steps and provides recommendations for which MCP tools would be most effective at each stage.Last updated -1361121TypeScriptMIT License
- -securityAlicense-qualityAn MCP server that implements the 'think' tool, providing Claude with a dedicated space for structured thinking during complex problem-solving tasks to improve reasoning capabilities.Last updated -48PythonMIT License
- -securityAlicense-qualityA minimal MCP Server that provides Claude AI models with the 'think' tool capability, enabling better performance on complex reasoning tasks by allowing the model to pause during response generation for additional thinking steps.Last updated -5251TypeScriptMIT License
- AsecurityAlicenseAqualityA sophisticated MCP server that provides a multi-dimensional, adaptive reasoning framework for AI assistants, replacing linear reasoning with a graph-based architecture for more nuanced cognitive processes.Last updated -117413TypeScriptMIT License