Metadata-Version: 2.4
Name: mofa-core
Version: 0.1.30
Summary: MoFA is a software framework for building AI agents through a composition-based approach.
Author: Cheng Chen, ZongHuan Wu
Author-email: chenzi00103@gmail.com, zonghuan.wu@gmail.com
Keywords: mofa ai agents dataflow composition
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pendulum>=3.0.0
Requires-Dist: python-dotenv==1.0.1
Requires-Dist: cookiecutter>=2.0.0
Requires-Dist: click>=8.0.0
Requires-Dist: openpyxl==3.1.5
Requires-Dist: attrs<26,>=25.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: openai==1.65.4
Requires-Dist: instructor<2.0.0,>=1.8.0
Requires-Dist: mem0ai>=0.1.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: pyarrow>=17.0.0
Requires-Dist: pyyaml
Requires-Dist: toml
Requires-Dist: mcp<2.0.0,>=1.9.0
Requires-Dist: fastmcp<3.0.0,>=2.2.0
Requires-Dist: dora-rs-cli>=0.3.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# MoFA 开发框架

[English](README_en.md) | [简体中文](README.md)

<p align="center">
    <img src="documents/images/mofa-logo.png" width="30%"/>
</p>

<div align="center">
  <a href="https://pypi.org/project/mofa-core/">
    <img src="https://img.shields.io/pypi/v/mofa-core.svg" alt="PyPI 最新版本"/>
  </a>
  <a href="https://github.com/mofa-org/mofa/blob/main/LICENSE">
    <img src="https://img.shields.io/github/license/mofa-org/mofa" alt="许可证"/>
  </a>
  <a href="https://github.com/mofa-org/mofa/stargazers">
    <img src="https://img.shields.io/github/stars/mofa-org/mofa" alt="GitHub 星标数"/>
  </a>
</div>

<h2 align="center">
  <a href="https://mofa.ai/">官网</a>
  |
  <a href="https://mofa.ai/docs/0overview/">快速入门</a>
  |
  <a href="https://github.com/mofa-org/mofa">GitHub</a>
  |
  <a href="https://hackathon.mofa.ai/">比赛</a>
  |
  <a href="https://discord.com/invite/hKJZzDMMm9">社区</a>
</h2>

---

## 1. 设计理念

MoFA 是一个用于构建可组合 AI 智能体的软件框架。通过 MoFA，开发者可以通过模板创建智能体（Agent），并以堆叠方式组合形成更强大的超级智能体（Super Agent）。

### 1.1 核心设计哲学

- **让普通人做非凡事**：AI 不应是精英专属，MoFA 让每个人都能开发和应用 AI，将不可能变为可能。
- **组合式 AI**：受 Unix 哲学启发，以"组合"为核心，像搭积木一样构建、连接智能体与工具，让 AI 简单、灵活且强大。
- **万物皆智能体**：在 MoFA 生态中，智能体是 AI 时代的应用载体——不仅是大语言模型，还可以是代码、脚本、API 甚至 MoFA 本身。
- **数据流驱动**：摒弃复杂工作流，采用更直观的数据流模式，使智能体可自由组合、拆解与复用。

### 1.2 技术架构图

<p align="center">
  <img src="documents/images/Organizational_Chart_cn.png" width="60%">
</p>

---

## 2. 核心特性

- **composable AI 架构**：通过模块化 Agent 堆叠组合，快速构建复杂智能体系统，支持多模型、多工具协同工作。
- **数据流驱动**：采用直观的数据流（DataFlow）模式替代传统工作流（Workflow），实现 Agent 间灵活解耦与动态重组。
- **全栈 Python 支持**：从 Agent 开发到数据流配置均提供 Python 友好接口，同时兼容 Rust 高性能节点扩展。
- **丰富的节点生态**：内置终端交互、LLM 调用、工具集成等基础节点，支持自定义节点快速接入。
- **多框架兼容**：基于 Dora-rs runtime 构建，支持与 ROS2、OpenTelemetry 等系统无缝集成。
- **MoFA Stage 可视化工具**：提供图形化界面，支持 Dataflow 和 Node 的可视化创建、管理与调试。

---

## 3. 支持矩阵

| 特性 | 支持程度 |
|------|----------|
| **API 支持** | Python 3.10+ [完全支持] <br> Rust 扩展 [实验性] |
| **操作系统** | Linux (Ubuntu 22.04) [完全支持] <br> macOS (ARM/x86) [完全支持] <br> WSL2 [完全支持] <br> Windows [暂不支持] |
| **通信方式** | 共享内存（本地）[完全支持] <br> TCP 网络（分布式）[实验性] |
| **消息格式** | JSON [完全支持] <br> Apache Arrow [实验性] |
| **LLM 集成** | OpenAI 系列 [完全支持] <br> Qwen 系列 [完全支持] <br> 本地模型（llama.cpp）[实验性] |
| **配置方式** | YAML 数据流定义 [完全支持] <br> Python 代码生成 [实验性] <br> MoFA Stage 图形化配置 [完全支持] |
| **包管理** | pip（Python 节点）[完全支持] <br> cargo（Rust 节点）[实验性] |

> 说明：
> - [完全支持] = 稳定可用的功能
> - [实验性] = 实验性支持（欢迎贡献）
> - [暂不支持] = 尚未支持

---

## 4. 快速开始

### 4.1 环境要求

**必需环境**：
- Python 3.10 或 3.11
- 操作系统：WSL（Ubuntu 22.04）、macOS、Linux
- 暂不支持 Windows 系统

**可选环境**（用于 Rust 节点开发）：
- Rust 工具链（rustc、cargo）

### 4.2 安装 MoFA

#### 方式 1：使用 pip 安装

```bash
# 创建虚拟环境（推荐）
python3 -m venv .mofa
source .mofa/bin/activate

# 从 PyPI 安装
pip install mofa-core

# 验证安装
mofa --help
```

#### 方式 2：使用 uv 安装（更快）

```bash
# 在虚拟环境中安装
uv venv .mofa
source .mofa/bin/activate
uv pip install mofa-core

# 或全局安装为独立工具
uv tool install mofa-core

# 验证安装
mofa --help
```

> **提示**：uv 是更快的 Python 包管理器。安装方法：[github.com/astral-sh/uv](https://github.com/astral-sh/uv)

#### 方式 3：从源码安装

```bash
pip install git+https://github.com/mofa-org/mofa.git
```

### 4.3 运行 Hello World 示例

```bash
# 克隆代码仓库
git clone https://github.com/mofa-org/mofa.git
cd mofa/dataflows/hello_world

# 运行数据流
mofa run-flow hello_world_dataflow.yml
```

**示例输出**：
```
Send Your Task: 你好
-------------hello_world_result---------------
你好
```

### 4.4 可选：安装 Rust 环境

如果需要开发或使用 Rust 节点：

```bash
# 安装 Rust 工具链
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# 安装过程中保持默认配置（直接按 Enter）

# 验证安装
rustc --version
cargo --version
```

---

## 5. MoFA Stage 可视化工具

MoFA Stage 是 MoFA 生态的图形化控制中心，支持在可视化界面中快速创建、管理和调试 Dataflow 与 Node。

### 5.1 核心功能

- **node/dataflow 模板库**：提供丰富的智能体模板，一键生成 node 项目
- **Dataflow 可视化创建**：通过拖拽式界面定义数据流，直观配置节点间的消息传递关系
- **Node 管理**：统一管理自定义节点与官方节点，支持快速接入新功能
- **智能体生命周期管理**：在图形化界面中启动、停止、监控智能体运行状态

### 5.2 界面预览

<p align="center">
  <img src="documents/images/mofastage-hub.png" alt="MoFA Hub 界面" width="80%"/>
  <br/>
  <i>Node Hub 界面</i>
</p>

<p align="center">
  <img src="documents/images/mofastage-dataflow.png" alt="创建 Agent 界面" width="80%"/>
  <br/>
  <i>Dataflow 界面</i>
</p>

---

## 6. 开发指南

### 6.1 快速开发指南

参考 [6分钟开发指南](https://mofa.ai/docs/2-getting-started/your-first-application/)，快速构建基于大语言模型的智能体，包含环境变量配置、项目初始化、逻辑实现、数据流定义全流程。

### 6.2 示例与文档

| 类型 | 名称 | 描述 | 最后更新 |
|------|------|------|----------|
| 入门 | [Hello World](https://github.com/mofa-org/mofa/tree/main/dataflows/hello_world) | 基础数据流交互示例 | ![更新时间](https://img.shields.io/github/last-commit/mofa-org/mofa?path=dataflows%2Fhello_world&label=Last%20Commit) |
| LLM | [Qwen 智能体](https://github.com/nanana2002/mofa-node-hub/tree/main/node-hub/QwenAgent) | 调用 Qwen API 的对话智能体 | ![更新时间](https://img.shields.io/github/last-commit/nanana2002/mofa-node-hub?path=node-hub%2FQwenAgent&label=Last%20Commit) |
| 工具集成 | [天气查询](https://github.com/nanana2002/mofa-node-hub/tree/main/node-hub/WeatherForecastNode) | 查询 IP 所在地天气的智能体 | ![更新时间](https://img.shields.io/github/last-commit/nanana2002/mofa-node-hub?path=node-hub%2FWeatherForecastNode&label=Last%20Commit) |

更多文档请参考 [MoFA 官方文档](https://docs.mofa-org.com)。

---

## 7. 常见问题

### 7.1 mofa 命令找不到

**问题描述**：安装 mofa-core 后，运行 `mofa` 命令提示找不到命令。

```bash
$ mofa --help
Command 'mofa' not found
```

**原因分析**：当使用 `pip install --user` 或系统 Python 进行用户级安装时，可执行文件会被安装到 `~/.local/bin` 目录，但该目录可能不在系统的 PATH 环境变量中。

**解决方法**：

#### 方案 1：添加 ~/.local/bin 到 PATH（推荐）

Bash 用户：
```bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

Zsh 用户：
```bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```

#### 方案 2：使用完整路径运行

```bash
~/.local/bin/mofa --help
```

#### 方案 3：在虚拟环境中安装（推荐）

使用 venv：
```bash
python3 -m venv .mofa
source .mofa/bin/activate
pip install mofa-core
mofa --help
```

使用 uv（更快）：
```bash
uv venv .mofa
source .mofa/bin/activate
uv pip install mofa-core
mofa --help
```

#### 验证 PATH 配置

```bash
# 检查 ~/.local/bin 是否在 PATH 中
echo $PATH | grep ".local/bin"

# 确认 mofa 安装位置
which mofa
```

### 7.2 依赖安装缓慢

**问题描述**：`pip install mofa-core` 下载速度很慢或超时。

**解决方法**：

使用国内镜像源加速安装：
```bash
# 使用清华镜像源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mofa-core

# 或使用阿里云镜像源
pip install -i https://mirrors.aliyun.com/pypi/simple/ mofa-core
```

永久配置镜像源：
```bash
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
```

---

## 8. 贡献指南

我们欢迎所有开发者参与贡献，无论您的经验水平如何。请参考[贡献指南](https://github.com/mofa-org/mofa/tree/main/documents)了解如何参与项目开发。

---

## 9. 社区交流

- [GitHub Discussions](https://github.com/mofa-org/mofa/discussions)
- [Discord 服务器](https://discord.com/invite/hKJZzDMMm9)

---

## 10. 许可证

本项目采用 Apache-2.0 许可证，详情参见 [LICENSE](LICENSE)。

---

## 11. 相关资源

- [Dora-rs 文档](https://dora-rs.ai/docs/guides/)

---

## 12. 星标历史

[![Star History Chart](https://api.star-history.com/svg?repos=mofa-org/mofa&type=Date)](https://www.star-history.com/#mofa-org/mofa&Date)


=======
History
=======

0.1.30 (2025-11-05)
------------------

* Auto-release: Merge pull request #98 from BH3GEI/main

0.1.29 (2025-11-05)
------------------

* Auto-release: feat: allow user to vibe based on existing agents

0.1.28 (2025-11-05)
------------------

* Auto-release: fix: docs outdated

0.1.27 (2025-11-05)
------------------

* Auto-release: fix: ubuntu not found command

0.1.25 (2025-11-05)
------------------

* Auto-release: Merge remote changes, use version 0.1.24

0.1.24 (2025-11-03)
------------------

* Auto-release: fix: fix mofa-run for .env loading

0.1.23 (2025-11-03)
------------------

* Auto-release: add: mofa version of dora voice

0.1.22 (2025-10-30)
------------------

* Auto-release: enhancement: optimize prompt to mention llm api

0.1.21 (2025-10-30)
------------------

* Auto-release: fix: fix yolo crash

0.1.20 (2025-10-30)
------------------

* Auto-release: feat: huge improvements on mofa vibe

0.1.19 (2025-10-30)
------------------

* Auto-release: enhance: optimize mofa-run command, allow user to run without install

0.1.18 (2025-10-29)
------------------

* Auto-release: Merge pull request #93 from yangrudan/enhance/mofa-unit-test

0.1.17 (2025-10-28)
------------------

* Auto-release: fix: run-flow

0.1.16 (2025-10-28)
------------------

* Auto-release: fix: run-flow

0.1.15 (2025-10-28)
------------------

* Auto-release: fix: run-flow

0.1.14 (2025-10-28)
------------------

* Auto-release: fix: run-flow

0.1.13 (2025-10-28)
------------------

* Auto-release: fix: run

0.1.12 (2025-10-28)
------------------

* Auto-release: fix: run-agent on ubnutu

0.1.11 (2025-10-28)
------------------

* Auto-release: fix: path

0.1.10 (2025-10-28)
------------------

* Auto-release: fix: ubuntu dependency error

0.1.9 (2025-10-28)
------------------

* Auto-release: fix: packaging

0.1.8 (2025-10-28)
------------------

* Auto-release: fix: init

0.1.7 (2025-10-28)
------------------

* Auto-release: fix: run-agent

0.1.6 (2025-10-27)
------------------

* Auto-release: fix: rust install

0.1.5 (2025-10-27)
------------------

* Auto-release: update: readme.md

0.1.4 (2025-10-27)
------------------

* Auto-release: fix: dir error

0.1.3 (2025-10-27)
------------------

* Auto-release: Fix: mofa vibe

0.1.2 (2025-10-27)
------------------

* Auto-release: feat: major update on cli

0.1.1 (2025-10-27)
------------------

* Auto-release: Fix: HEREDOC

0.1.0 (2025-10-27)
------------------

* First release of mofa-core (renamed from mofa-ai)
* mofa vibe command - AI-powered agent generator with automatic testing and optimization
* mofa debug command - Unit testing and debugging for individual nodes with test case support
* mofa run command - Run dataflows in isolated virtual environments with automatic dependency management
* mofa new-agent command - Create new agents from templates
* Interactive input support for better user experience
* Optimized package installation with uv support
* Python 3.10, 3.11, and 3.12 support
* Full integration with dora-rs dataflow runtime
