100 lines
3.6 KiB
Markdown
100 lines
3.6 KiB
Markdown
## Introduction
|
|
|
|
Humanus (meaning "human" in Latin) is a lightweight framework inspired by OpenManus, integrated with the Model Context Protocol (MCP). `humanus.cpp` enables more flexible tool choices, and provides a foundation for building powerful local LLM agents.
|
|
|
|
Let's embrace local LLM agents w/ humanus.cpp!
|
|
|
|
## Overview
|
|
```bash
|
|
humanus.cpp/
|
|
├── 📄 config.cpp/.h # 配置系统头文件
|
|
├── 📄 llm.cpp/.h # LLM集成主实现文件
|
|
├── 📄 logger.cpp/.h # 日志系统实现文件
|
|
├── 📄 main.cpp # 程序入口文件
|
|
├── 📄 prompt.cpp/.h # 预定义提示词
|
|
├── 📄 schema.cpp/.h # 数据结构定义实现文件
|
|
├── 📄 toml.hpp # TOML配置文件解析库
|
|
├── 📂 agent/ # 代理模块目录
|
|
│ ├── 📄 base.h # 基础代理接口定义
|
|
│ ├── 📄 humanus.h # Humanus核心代理实现
|
|
│ ├── 📄 react.h # ReAct代理实现
|
|
│ └── 📄 toolcall.cpp/.h # 工具调用实现文件
|
|
├── 📂 flow/ # 工作流模块目录
|
|
│ ├── 📄 base.h # 基础工作流接口定义
|
|
│ ├── 📄 flow_factory.h # 工作流工厂类
|
|
│ └── 📄 planning.cpp/.h # 规划型工作流实现文件
|
|
├── 📂 mcp/ # 模型上下文协议(MCP)实现目录
|
|
├── 📂 memory/ # 内存管理模块
|
|
│ ├── 📄 base.h # 基础内存接口定义
|
|
│ └── 📂 mem0/ # TODO: mem0记忆实现
|
|
├── 📂 server/ # 服务器模块
|
|
│ ├── 📄 mcp_server_main.cpp # MCP服务器入口文件
|
|
│ └── 📄 python_execute.cpp # Python执行环境集成实现
|
|
├── 📂 spdlog/ # 第三方日志库
|
|
└── 📂 tool/ # 工具模块目录
|
|
├── 📄 base.h # 基础工具接口定义
|
|
├── 📄 filesystem.h # 文件系统操作工具
|
|
├── 📄 planning.cpp/.h # 规划工具实现
|
|
├── 📄 puppeteer.h # Puppeteer浏览器自动化工具
|
|
├── 📄 python_execute.h # Python执行工具
|
|
├── 📄 terminate.h # 终止工具
|
|
└── 📄 tool_collection.h # 工具集合定义
|
|
```
|
|
|
|
|
|
## Features
|
|
|
|
## How to Build
|
|
|
|
```bash
|
|
git submodule update --init --recursive
|
|
|
|
cmake -B build
|
|
cmake --build build --config Release
|
|
```
|
|
|
|
## How to Run
|
|
|
|
Switch to your own configration first:
|
|
1. Replace `base_url`, `api_key`, .etc in `config/config_llm.toml` according to your need.
|
|
2. Fill in `args` after `"@modelcontextprotocol/server-filesystem"` for `filesystem` to control the access to files. For example:
|
|
```
|
|
[filesystem]
|
|
type = "stdio"
|
|
command = "npx"
|
|
args = ["-y",
|
|
"@modelcontextprotocol/server-filesystem",
|
|
"/Users/{username}/Desktop",
|
|
"other/path/to/your/files]
|
|
```
|
|
|
|
Start a MCP server with tool `python_execute` on port 8818:
|
|
```bash
|
|
./build/bin/mcp_server # Unix/MacOS
|
|
```
|
|
|
|
```shell
|
|
.\build\bin\Release\mcp_server.exe # Windows
|
|
```
|
|
|
|
Run agent `Humanus` with tools `python_execute`, `filesystem` and `puppeteer` (for browser use):
|
|
|
|
```bash
|
|
./build/bin/humanus_cli # Unix/MacOS
|
|
```
|
|
|
|
```shell
|
|
.\build\bin\Release\humanus_cli.exe # Windows
|
|
```
|
|
|
|
Run experimental planning flow (only agent `Humanus` as executor):
|
|
```bash
|
|
./build/bin/humanus_cli_plan # Unix/MacOS
|
|
```
|
|
|
|
```shell
|
|
.\build\bin\Release\humanus_cli_plan.exe # Windows
|
|
```
|
|
|
|
|