Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 47 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ LangManus is a community-driven AI automation framework that builds upon the inc
[![Demo](./assets/demo.gif)](./assets/demo.mp4)

- [View on YouTube](https://youtu.be/sZCHqrQBUGk)
- [Download Video](https://github.com/langmanus/langmanus/blob/main/assets/demo.mp4)
- [Download Video](https://github.com/Darwin-lfl/langmanus/blob/main/assets/demo.mp4)

## Table of Contents

- [Quick Start](#quick-start)
- [Architecture](#architecture)
- [Features](#features)
- [Why LangManus?](#why-langmanus)
- [Setup](#setup)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Web UI](#web-ui)
- [Development](#development)
Expand All @@ -38,7 +39,7 @@ LangManus is a community-driven AI automation framework that builds upon the inc

```bash
# Clone the repository
git clone https://github.com/langmanus/langmanus.git
git clone https://github.com/Darwin-lfl/langmanus.git
cd langmanus

# Create and activate virtual environment through uv
Expand Down Expand Up @@ -77,32 +78,37 @@ The system consists of the following agents working together:
## Features

### Core Capabilities

- 🤖 **LLM Integration**
- Support for open source models like Qwen
- OpenAI-compatible API interface
- Multi-tier LLM system for different task complexities
- Support for open source models like Qwen
- OpenAI-compatible API interface
- Multi-tier LLM system for different task complexities

### Tools and Integrations

- 🔍 **Search and Retrieval**
- Web search via Tavily API
- Neural search with Jina
- Advanced content extraction
- Web search via Tavily API
- Neural search with Jina
- Advanced content extraction

### Development Features

- 🐍 **Python Integration**
- Built-in Python REPL
- Code execution environment
- Package management with uv
- Built-in Python REPL
- Code execution environment
- Package management with uv

### Workflow Management

- 📊 **Visualization and Control**
- Workflow graph visualization
- Multi-agent orchestration
- Task delegation and monitoring
- Workflow graph visualization
- Multi-agent orchestration
- Task delegation and monitoring

## Why LangManus?

We believe in the power of open source collaboration. This project wouldn't be possible without the amazing work of projects like:

- [Qwen](https://github.com/QwenLM/Qwen) for their open source LLMs
- [Tavily](https://tavily.com/) for search capabilities
- [Jina](https://jina.ai/) for neural search technology
Expand Down Expand Up @@ -165,9 +171,9 @@ CHROME_INSTANCE_PATH=/Applications/Google Chrome.app/Contents/MacOS/Google Chrom
> **Note:**
>
> - The system uses different models for different types of tasks:
> - Reasoning LLM for complex decision-making and analysis
> - Basic LLM for simpler text-based tasks
> - Vision-Language LLM for tasks involving image understanding
> - Reasoning LLM for complex decision-making and analysis
> - Basic LLM for simpler text-based tasks
> - Vision-Language LLM for tasks involving image understanding
> - You can customize the base URLs for all LLMs independently
> - Each LLM can use different API keys if needed
> - Jina API key is optional. Provide your own key to access a higher rate limit (get your API key at [jina.ai](https://jina.ai/))
Expand All @@ -180,19 +186,23 @@ cp .env.example .env
```

### Configure Pre-commit Hook

LangManus includes a pre-commit hook that runs linting and formatting checks before each commit. To set it up:

1. Make the pre-commit script executable:

```bash
chmod +x pre-commit
```

2. Install the pre-commit hook:

```bash
ln -s ../../pre-commit .git/hooks/pre-commit
```

The pre-commit hook will automatically:

- Run linting checks (`make lint`)
- Run code formatting (`make format`)
- Add any reformatted files back to staging
Expand Down Expand Up @@ -223,20 +233,19 @@ uv run server.py
The API server exposes the following endpoints:

- `POST /api/chat/stream`: Chat endpoint for LangGraph invoke with streaming support
- Request body:
```json
{
"messages": [
{"role": "user", "content": "Your query here"}
],
"debug": false
}
```
- Returns a Server-Sent Events (SSE) stream with the agent's responses
- Request body:
```json
{
"messages": [{ "role": "user", "content": "Your query here" }],
"debug": false
}
```
- Returns a Server-Sent Events (SSE) stream with the agent's responses

### Advanced Configuration

LangManus can be customized through various configuration files in the `src/config` directory:

- `env.py`: Configure LLM models, API keys, and base URLs
- `tools.py`: Adjust tool-specific settings (e.g., Tavily search results limit)
- `agents.py`: Modify team composition and agent system prompts
Expand All @@ -252,20 +261,22 @@ LangManus uses a sophisticated prompting system in the `src/prompts` directory t
- **Researcher ([`src/prompts/researcher.md`](src/prompts/researcher.md))**: Specializes in information gathering through web searches and data collection. Uses Tavily search and web crawling capabilities while avoiding mathematical computations or file operations.

- **Coder ([`src/prompts/coder.md`](src/prompts/coder.md))**: Professional software engineer role focused on Python and bash scripting. Handles:
- Python code execution and analysis
- Shell command execution
- Technical problem-solving and implementation

- Python code execution and analysis
- Shell command execution
- Technical problem-solving and implementation

- **File Manager ([`src/prompts/file_manager.md`](src/prompts/file_manager.md))**: Handles all file system operations with a focus on properly formatting and saving content in markdown format.

- **Browser ([`src/prompts/browser.md`](src/prompts/browser.md))**: Web interaction specialist that handles:
- Website navigation
- Page interaction (clicking, typing, scrolling)
- Content extraction from web pages
- Website navigation
- Page interaction (clicking, typing, scrolling)
- Content extraction from web pages

#### Prompt System Architecture

The prompts system uses a template engine ([`src/prompts/template.py`](src/prompts/template.py)) that:

- Loads role-specific markdown templates
- Handles variable substitution (e.g., current time, team member information)
- Formats system prompts for each agent
Expand Down
84 changes: 47 additions & 37 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ LangManus 是一个社区驱动的 AI 自动化框架,它建立在开源社区
[![Demo](./assets/demo.gif)](./assets/demo.mp4)

- [在 YouTube 上观看](https://youtu.be/sZCHqrQBUGk)
- [下载视频](https://github.com/langmanus/langmanus/blob/main/assets/demo.mp4)
- [下载视频](https://github.com/Darwin-lfl/langmanus/blob/main/assets/demo.mp4)

## 目录

- [快速开始](#快速开始)
- [架构](#架构)
- [功能特性](#功能特性)
- [为什么选择 LangManus?](#为什么选择-langmanus)
- [安装设置](#安装设置)
- [前置要求](#前置要求)
- [安装步骤](#安装步骤)
- [配置](#配置)
- [前置要求](#前置要求)
- [安装步骤](#安装步骤)
- [配置](#配置)
- [使用方法](#使用方法)
- [网页界面](#网页界面)
- [开发](#开发)
Expand All @@ -41,7 +42,7 @@ LangManus 是一个社区驱动的 AI 自动化框架,它建立在开源社区

```bash
# 克隆仓库
git clone https://github.com/langmanus/langmanus.git
git clone https://github.com/Darwin-lfl/langmanus.git
cd langmanus

# 用uv创建并激活虚拟环境
Expand Down Expand Up @@ -80,32 +81,37 @@ LangManus 实现了一个分层的多智能体系统,其中有一个主管智
## 功能特性

### 核心能力

- 🤖 **LLM 集成**
- 支持通义千问等开源模型
- OpenAI 兼容的 API 接口
- 多层 LLM 系统适配不同任务复杂度
- 支持通义千问等开源模型
- OpenAI 兼容的 API 接口
- 多层 LLM 系统适配不同任务复杂度

### 工具和集成

- 🔍 **搜索和检索**
- 通过 Tavily API 进行网络搜索
- 使用 Jina 进行神经搜索
- 高级内容提取
- 通过 Tavily API 进行网络搜索
- 使用 Jina 进行神经搜索
- 高级内容提取

### 开发特性

- 🐍 **Python 集成**
- 内置 Python REPL
- 代码执行环境
- 使用 uv 进行包管理
- 内置 Python REPL
- 代码执行环境
- 使用 uv 进行包管理

### 工作流管理

- 📊 **可视化和控制**
- 工作流程图可视化
- 多智能体编排
- 任务分配和监控
- 工作流程图可视化
- 多智能体编排
- 任务分配和监控

## 为什么选择 LangManus?

我们信奉开源协作的力量。本项目的实现离不开以下优秀项目的支持:

- [Qwen](https://github.com/QwenLM/Qwen):提供开源语言模型
- [Tavily](https://tavily.com/):提供搜索能力
- [Jina](https://jina.ai/):提供神经搜索技术
Expand Down Expand Up @@ -170,9 +176,9 @@ CHROME_INSTANCE_PATH=/Applications/Google Chrome.app/Contents/MacOS/Google Chrom
> **注意:**
>
> - 系统对不同类型的任务使用不同的模型:
> - 推理 LLM 用于复杂的决策和分析
> - 基础 LLM 用于简单的文本任务
> - 视觉语言 LLM 用于涉及图像理解的任务
> - 推理 LLM 用于复杂的决策和分析
> - 基础 LLM 用于简单的文本任务
> - 视觉语言 LLM 用于涉及图像理解的任务
> - 所有 LLM 的基础 URL 都可以独立自定义
> - 每个 LLM 可以使用不同的 API 密钥
> - Jina API 密钥是可选的,提供自己的密钥可以获得更高的速率限制(你可以在 [jina.ai](https://jina.ai/) 获该密钥)
Expand All @@ -185,19 +191,23 @@ cp .env.example .env
```

### 配置预提交钩子

LangManus 包含一个预提交钩子,在每次提交前运行代码检查和格式化。设置步骤:

1. 使预提交脚本可执行:

```bash
chmod +x pre-commit
```

2. 安装预提交钩子:

```bash
ln -s ../../pre-commit .git/hooks/pre-commit
```

预提交钩子将自动:

- 运行代码检查(`make lint`)
- 运行代码格式化(`make format`)
- 将任何重新格式化的文件添加回暂存区
Expand Down Expand Up @@ -228,21 +238,19 @@ uv run server.py
API 服务器提供以下端点:

- `POST /api/chat/stream`:用于 LangGraph 调用的聊天端点,流式响应
- 请求体:
```json
{
"messages": [
{"role": "user", "content": "在此输入您的查询"}
],
"debug": false
}
```
- 返回包含智能体响应的服务器发送事件(SSE)流

- 请求体:
```json
{
"messages": [{ "role": "user", "content": "在此输入您的查询" }],
"debug": false
}
```
- 返回包含智能体响应的服务器发送事件(SSE)流

### 高级配置

LangManus 可以通过 `src/config` 目录中的各种配置文件进行自定义:

- `env.py`:配置 LLM 模型、API 密钥和基础 URL
- `tools.py`:调整工具特定设置(如 Tavily 搜索结果限制)
- `agents.py`:修改团队组成和智能体系统提示
Expand All @@ -258,20 +266,22 @@ LangManus 在 `src/prompts` 目录中使用复杂的提示系统来定义智能
- **研究员([`src/prompts/researcher.md`](src/prompts/researcher.md))**:专门通过网络搜索和数据收集来收集信息。使用 Tavily 搜索和网络爬取功能,避免数学计算或文件操作。

- **程序员([`src/prompts/coder.md`](src/prompts/coder.md))**:专业软件工程师角色,专注于 Python 和 bash 脚本。处理:
- Python 代码执行和分析
- Shell 命令执行
- 技术问题解决和实现

- Python 代码执行和分析
- Shell 命令执行
- 技术问题解决和实现

- **文件管理员([`src/prompts/file_manager.md`](src/prompts/file_manager.md))**:处理所有文件系统操作,重点是正确格式化和保存 markdown 格式的内容。

- **浏览器([`src/prompts/browser.md`](src/prompts/browser.md))**:网络交互专家,处理:
- 网站导航
- 页面交互(点击、输入、滚动)
- 从网页提取内容
- 网站导航
- 页面交互(点击、输入、滚动)
- 从网页提取内容

#### 提示系统架构

提示系统使用模板引擎([`src/prompts/template.py`](src/prompts/template.py))来:

- 加载特定角色的 markdown 模板
- 处理变量替换(如当前时间、团队成员信息)
- 为每个智能体格式化系统提示
Expand Down