Sage is an open source multi-agent system framework that focuses on decomposing complex tasks into manageable sub-tasks that can be accomplished through the collaboration of multiple intelligent agents. It is based on Python , supports DeepSeek-V3, GPT-4, Claude-3.5 and other language models , suitable for enterprise-level applications . Sage provides deep thinking mode and fast execution mode , to adapt to different task requirements. Users can enjoy real-time monitoring and dynamic workflow management through interactive web interface or command line operation. The project is hosted on GitHub under the MIT license, with an active community and is continuously updated to version 0.9.2.
Function List
- Breakdown of tasks: Automatically split complex tasks into subtasks and track dependencies.
- Agent Collaboration: Multiple agents (analyze, plan, execute, observe, summarize) work together seamlessly.
- tooling system: Supports plug-in tools to automatically discover and integrate external APIs.
- dual implementation mode: Provides deep thinking mode (detailed analysis) and fast execution mode (efficient completion).
- web interface: Based on React and FastAPI with a modern interface that supports real-time task visualization.
- token monitoring: Track model usage in real time to optimize cost and performance.
- Customized workflows: Create and manage complex workflows through visual editors.
- error handling: Built-in retry mechanism and error recovery to ensure system stability.
Using Help
Installation process
Sage is easy to install and supports Windows, macOS and Linux systems. Here are the steps to install Sage based on the GitHub repository:
- clone warehouse
Open a terminal and run the following command to get the Sage source code:git clone https://github.com/ZHangZHengEric/Sage.git cd Sage
- Installing core dependencies
Install the Python packages required by the Sage core framework:pip install -r requirements.txt
- Make sure Python version is 3.10 or higher.
- Core dependencies include
openai
,pydantic
,python-dotenv
etc.
- Installation of Web interface dependencies (optional)
Install additional dependencies if you need to use FastAPI and React's web interface:pip install -r examples/fastapi_react_demo/requirements.txt
- including through
fastapi
,uvicorn
,websockets
Waiting for the package.
- including through
- Configuring Environment Variables
establish.env
file, adding API keys and other configuration. Example:echo "OPENAI_API_KEY=your_openai_key" >> .env echo "SAGE_DEBUG=true" >> .env
- referable
mcp_setting_example.json
configure MCP Server Connection.
- referable
- Run Sage
- command-line mode: Run a Python script directly to invoke Sage functions, for example:
python sagents/main.py
- web interface: Start the FastAPI server:
cd examples/fastapi_react_demo uvicorn main:app --host 0.0.0.0 --port 8080
interviews
http://localhost:8080
View the web interface.
- command-line mode: Run a Python script directly to invoke Sage functions, for example:
- Verify Installation
After running, the web interface should display the interactive task management page. Command line mode outputs Sage version information (currently 0.9.2).
Using the main functions
Sage simplifies complex tasks through multi-agent collaboration and a modern interface. Here's how to use the core features:
- Task decomposition and agent collaboration
Sage breaks down tasks into subtasks and assigns them to different agents. Users enter tasks, such as "Analyze market trends and generate a report" via the web interface or command line. Step-by-step:- web interface: in
http://localhost:8080
Enter the task description and click "Submit". The interface will display the task decomposition process, including the stages of analysis, planning and execution. - command line (computing): Run the sample script:
from sagents import AgentController controller = AgentController() controller.run_task("分析市场趋势并生成报告")
- Agents included:
- Analyzing Agents: Understand the context of the task and provide contextual analysis.
- decompose an agent: Split the task into subtasks to generate a dependency graph.
- Planning Agent: Selection of appropriate tools and sequence of execution.
- executing agent: Calls a tool or API to perform subtasks.
- Observation Agents: Monitor progress and check quality of completion.
- Summary Agent: Integrate results to generate structured output.
- web interface: in
- Customized workflows
Sage provides a visual workflow editor that allows users to design task processes:- Access the web interface and click on Workflow Editor.
- Use the drag and drop interface to add nodes (e.g. "Analyze Data" or "Generate Graph").
- Set up dependencies between nodes and save as a template.
- Example: Create a workflow that contains three steps: "Data Collection → Analysis → Report Generation", which will be automatically executed by the system.
- Command line users can edit YAML files to define workflows:
workflow: - step: 数据收集 action: call_api params: {url: "https://api.example.com/data"} - step: 数据分析 action: analyze_data depends_on: 数据收集
- tooling system
Sage supports plug-in tools that automatically discover local or remote tools. For example, connecting to an MCP server:- configure
mcp_setting.json
::{ "mcp_server": "http://example.com:20040", "api_key": "your_api_key" }
- In the web interface, the tool is automatically displayed in the "Tool Management" screen, click Enable or Disable.
- Command line users can invoke the tool via a script:
from sagents.tools import ToolManager manager = ToolManager() manager.use_tool("excel_parser", file="data.xlsx")
- configure
- Deep Thinking Model and Rapid Implementation Model
- reflection mode: Suitable for complex tasks, enables all agents, generates detailed analysis and summarization.
- Web Interface: Select "Reflective Mode", enter a task, and view the complete execution.
- Command line: set
mode=deep
::controller.run_task("分析市场趋势", mode="deep")
- Rapid implementation mode: Skip the analysis and execute the task directly, suitable for simple needs.
- Web Interface: Select "Quick Mode", enter the task and get the result immediately.
- Command line: set
mode=rapid
::controller.run_task("生成图表", mode="rapid")
- reflection mode: Suitable for complex tasks, enables all agents, generates detailed analysis and summarization.
- token monitoring
Sage provides real-time token usage statistics to optimize costs:- Web Interface: You can view the input, output, and cache token usage on the Monitor screen.
- Command line: enable debug mode to view logs:
export SAGE_DEBUG=true python sagents/main.py
- The system automatically compresses messages to reduce token consumption for 30%-70%.
- real time interruption
The user can interrupt the task at any time:- Web Interface: Click the "Stop" button, the system will pause in 1-2 seconds to save the intermediate results.
- Command line: press
Ctrl+C
The task status is saved to the workspace.
Featured Function Operation
- Web Interface Interaction::
- interviews
http://localhost:8080
or online demohttp://36.133.44.114:20040
The - Use "thought bubbles" to view the agent's reasoning process, with support for expanding and collapsing.
- Configure rule preferences (
/rules
), adjusting AI behavior, such as language style or code specification.
- interviews
- Document Viewer::
- In the web interface, click on a file link to view the content directly in the sidebar without downloading.
- Support for Markdown, code and other formats, optimized for displaying mathematical formulas.
- MCP Server Integration::
- configure
mcp_setting.json
Connects to remote servers and supports SSE protocol and API key authentication. - Example: Run the MCP server and auto-discover the tool:
python mcp_servers/main.py --config mcp_setting.json
- configure
application scenario
- Automated report generation
Sage breaks down the task of generating a market analysis report, collecting data, analyzing trends, generating charts, and ultimately outputting a structured report suitable for enterprise data analysis. - Code Development Assistance
Developers use Sage to plan code structure, generate code snippets, validate logic, and support custom code styles for software development teams. - Academic research support
Researchers use deep thinking patterns to analyze complex problems, call external APIs to get data, and generate visualization results suitable for academic papers. - Content creation optimization
Content creators generate article outlines, drafts, and final content through custom workflows with support for multi-language output for marketing teams.
QA
- What language models does Sage support?
Sage supports models such as DeepSeek-V3, Qwen-3, GPT-4.1, Claude-3.5 Sonnet, etc., and is compatible with APIs from OpenAI, Anthropic, Google AI, and other providers. - How do I access the web interface?
Access after installationhttp://localhost:8080
or use the online demohttp://36.133.44.114:20040
The - How is Sage different from other automation frameworks?
Sage specializes in multi-agent collaboration and task decomposition, supporting visual workflow editing and real-time monitoring for automating complex tasks. - How do I contribute code?
interviewshttps://github.com/ZHangZHengEric/Sage
To submit an Issue or Pull Request, refer todocs/CONTRIBUTING.md
The