Skip to main content

AI-powered OPC business document generation agent with multi-LLM backend support

Project description

🚀 OPC-Agents — 一人公司智能任务执行系统

版本: v0.1.2 | 状态: Beta | 许可: Apache-2.0

Beta Python 3.9+ License: Apache-2.0 PyPI


语言: 中文 | English | 日本語


这是什么

OPC-Agents(One-Person Company Agents)是一个面向一人公司/独立创业者/自由职业者的智能任务执行系统

核心理念:告诉系统你要什么结果,它直接做完并交付文件给你。

不是聊天机器人,不是建议引擎,是能干活的执行者

它能做什么

你说 系统交付
"帮我收集OPC公司趋势" 🔍 研究报告(真实搜索结果+来源链接+结构化整理)
"帮我写Q2营销方案" ✍️ 完整方案文档(SMART目标+路线图+资源/风险/验收标准)
"帮我分析竞品A" 📊 分析报告(SWOT+行动清单+优先级排序)
"帮我制定产品发布计划" 🚀 发布方案(定价策略+推广渠道+时间线)

关键特性

  • LLM增强内容生成 — 接入Claude Sonnet 4,高质量中文输出
  • 真实网络搜索 — DuckDuckGo实时搜索,不编造数据
  • 零占位符保证 — 每个输出都有具体的、可操作的内容
  • 异步执行 — 提交即返回,后台执行,预估进度指示
  • 知识库兜底 — 6类20条专业知识,搜索失败时自动兜底
  • 文件交付 — 自动生成.md文件,提供下载按钮
  • 多轮对话 — 支持上下文连续的迭代优化
  • 安全防护 — 输入验证+Prompt注入防护+URL安全+错误脱敏
  • 测试覆盖 — 277+个测试用例,100%通过率,CI自动验证

快速开始

前提条件

  • Python 3.9+
  • 至少一个LLM API Key(推荐 MOKA

方式一:pip 安装

# 1. 安装
pip install opc-agents

# 2. 创建工作目录并配置API Key
mkdir my-opc-workspace && cd my-opc-workspace
echo "MOKA_API_KEY=your-key-here" > .env

# 3. 启动
opc-agents

pip安装后,.env文件、成果物文件、日志文件都存放在当前工作目录。

方式二:源码安装(推荐开发者)

git clone https://github.com/lulin70/OPC-Agents.git
cd OPC-Agents
chmod +x install.sh start.sh
./install.sh

# 配置API Key
cp .env.example .env
# 编辑 .env,填入你的MOKA API Key

# 启动
./start.sh

关于API Key

后端 模型 配置环境变量 质量 获取方式
MOKA(推荐) Claude Sonnet 4 MOKA_API_KEY ⭐⭐⭐⭐⭐ moka-ai.com
智谱GLM GLM-4 GLM_API_KEY ⭐⭐⭐⭐ open.bigmodel.cn
OpenAI GPT-4o OPENAI_API_KEY ⭐⭐⭐⭐ platform.openai.com
Ollama 本地模型 OLLAMA_BASE_URL ⭐⭐⭐ ollama.com

不配置API Key也能使用(模板模式),但内容质量有限。强烈建议至少配置一个API Key。

故障排查

问题 解决方案
页面显示"模板模式" 检查 .env 文件中 API Key 是否已填入
端口被占用 opc-agents -- --server.port 8502
Python版本不对 需要 Python 3.9+,运行 python3 --version 检查
安装依赖失败 尝试 pip install --upgrade pip 后重试

项目结构

OPC-Agents/
├── frontend/              # Streamlit前端
│   └── app.py             # 主界面(异步执行+进度指示+成果物管理)
├── opc_manager/           # 核心业务逻辑
│   ├── task_engine_v3.py  # 任务执行引擎
│   ├── llm_content.py     # LLM增强内容生成(RAG混合模式)
│   ├── llm_service.py     # LLM服务层(MOKA/GLM/OpenAI/Ollama)
│   ├── search_processor.py# 搜索结果后处理(TF-IDF+知识库兜底)
│   ├── async_executor.py  # 异步任务执行器
│   ├── session_context.py # 多轮对话上下文管理
│   ├── validators.py      # 输入验证层(Pydantic模型)
│   ├── business_type_detector_v2.py  # 业务类型检测
│   ├── business_types.py             # 业务类型枚举定义
│   ├── scenario_engine_v2.py         # 场景匹配引擎
│   ├── flywheel_tracker.py           # 成长飞轮追踪
│   ├── persona_manager.py            # 人格管理
│   ├── monitoring.py                 # 监控与日志
│   ├── config.py                     # 配置管理
│   └── version.py         # 版本号管理(SSOT)
├── opc_hr/                # 搜索与知识库
│   └── web_search.py      # DuckDuckGo网络搜索
├── config/                # 配置文件
│   └── persona_variants.yaml  # 6种业务类型人格配置
├── tests/                 # 测试套件(277+个测试,100%通过)
├── docs/                  # 项目文档
├── requirements.txt       # 核心依赖
├── requirements-dev.txt   # 开发依赖(含black/flake8/pytest)
├── .env.example           # 环境变量模板
├── install.sh             # 一键安装脚本
├── start.sh               # 一键启动脚本
└── VERSION                # 版本号文件

测试

# 安装开发依赖
pip install -r requirements-dev.txt

# 运行全部测试
PYTHONPATH=. pytest tests/ -v

# 运行并生成覆盖率报告
PYTHONPATH=. pytest tests/ --cov=opc_manager --cov-report=term-missing

版本历史

版本 日期 里程碑
0.1.2 2026-04-28 安全加固+性能优化:XSS修复、Prompt注入防护、单例模式、线程安全
0.1.1-beta 2026-04-27 Bug修复:LLM初始化/搜索依赖/场景路径/上下文污染/占位符替换
0.1.0-beta 2026-04-24 Beta发布:安装流程修复、安全加固、CI通过
0.1.0 2026-04-23 "可信可用":版本统一、Mock删除、MOKA API接入、异步执行

许可

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opc_agents-0.1.2.post1.tar.gz (126.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opc_agents-0.1.2.post1-py3-none-any.whl (124.7 kB view details)

Uploaded Python 3

File details

Details for the file opc_agents-0.1.2.post1.tar.gz.

File metadata

  • Download URL: opc_agents-0.1.2.post1.tar.gz
  • Upload date:
  • Size: 126.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for opc_agents-0.1.2.post1.tar.gz
Algorithm Hash digest
SHA256 5edf40d2ef724d9832dcb06a39ec302754425754c4da6c92c1ed375500fc7660
MD5 b648aaf453aca01d020c0d2ac0b10422
BLAKE2b-256 09dda74860f5526db18a041bac99db6c45113ded2b1f3cb17bb77e2dd11d4549

See more details on using hashes here.

File details

Details for the file opc_agents-0.1.2.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for opc_agents-0.1.2.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 60ea0db15b3c9a6580def197453ef8b9250d4e57fecdc8dde35d62057a0c46ad
MD5 c4e60af9b60b8f5c5067d660d7f0007c
BLAKE2b-256 4a338beafbcb2dfac1e3913f2b12a2014904cd361dee239dce26880b768bc207

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page