自主 Hands

LibreFang 的核心创新——7 个预构建的自主能力包,独立运行、按计划执行,无需人工干预。


概述

Hands 是 LibreFang 的独特功能,它们是自主工作的 Agent,可以:

  • 按计划自动执行任务
  • 跨多个平台操作
  • 处理复杂的多步骤工作流
  • 在无人干预的情况下做出决策

7 个内置 Hands

Hand功能自主级别
ClipYouTube 视频下载、剪辑、字幕生成、垂直短视频发布
Lead每日潜在客户发现、信息丰富、0-100 评分、去重
CollectorOSINT 情报收集、变更检测、情感追踪、知识图谱
Predictor超级预测引擎、置信区间、反向模式
Researcher深度自主研究、CRAAP 可信度评估、APA 引用
Twitter自主 X/Twitter 账号管理、7 种内容格式、审批队列
BrowserWeb 自动化、Playwright、强制购买审批 gate

Clip Hand

YouTube 视频自动化 Hand。

功能

  • 视频下载(支持多种格式和质量)
  • 自动剪辑和裁剪
  • 字幕生成和翻译
  • 垂直短视频适配(9:16)
  • 自动发布到社交平台

配置

[clip]
youtube_quality = "1080p"
auto_subtitle = true
vertical_format = true
publish_targets = ["tiktok", "youtube_shorts"]

CLI 命令

# 激活 Clip Hand
librefang hand activate clip

# 下载视频
librefang hand clip download "https://youtube.com/watch?v=..."

# 剪辑视频
librefang hand clip clip --start 60 --end 120 --input video.mp4

# 生成字幕
librefang hand clip subtitle --lang zh video.mp4

Lead Hand

每日潜在客户发现和评分 Hand。

功能

  • 自动发现潜在客户
  • 企业信息丰富(规模、行业、联系方式)
  • 0-100 质量评分
  • 去重和合并
  • CRM 集成

配置

[lead]
icp = "companies in AI space, >100 employees, Series A+"
search_sources = ["linkedin", "crunchbase", "hunter"]
score_criteria = ["funding", "tech_stack", "team_size"]
deduplicate = true
crm_integration = "salesforce"

CLI 命令

# 激活 Lead Hand
librefang hand activate lead

# 手动运行潜在客户发现
librefang hand lead discover --icp "B2B SaaS, >50 employees"

# 查看潜在客户列表
librefang hand lead list

# 导出到 CSV
librefang hand lead export --format csv

Collector Hand

OSINT 情报收集 Hand。

功能

  • 持续监控目标
  • 变更检测和通知
  • 情感分析
  • 知识图谱构建
  • 多源数据聚合

配置

[collector]
targets = ["competitor.com", "industry-news.com"]
monitor_interval = "1h"
sentiment_analysis = true
knowledge_graph = true
alert_channels = ["telegram", "email"]

CLI 命令

# 激活 Collector Hand
librefang hand activate collector

# 添加监控目标
librefang hand collector add-target "https://example.com"

# 查看收集的数据
librefang hand collector list

# 导出知识图谱
librefang hand collector export-graph

Predictor Hand

超级预测引擎 Hand。

功能

  • 基于数据的预测
  • 置信区间计算
  • 反向模式识别
  • 预测验证和校准
  • 趋势分析

配置

[predictor]
prediction_horizon = "30d"
confidence_level = 0.95
contrarian_mode = true
calibration_history = true

CLI 命令

# 激活 Predictor Hand
librefang hand activate predictor

# 创建预测
librefang hand predictor predict --question "Will Q4 revenue exceed $1M?"

# 查看预测历史
librefang hand predictor history

# 验证预测
librefang hand predictor verify --prediction-id <id> --actual <value>

Researcher Hand

深度自主研究 Hand。

功能

  • 自动研究主题
  • 多源信息收集
  • CRAAP 可信度评估
  • APA 格式引用
  • 结构化报告生成

配置

[scientist]
sources = ["academic", "news", "reports"]
citation_format = "apa"
max_sources = 20
credibility_threshold = 0.7
report_format = "markdown"

CLI 命令

# 激活 Researcher Hand
librefang hand activate researcher

# 执行研究
librefang hand researcher search "impact of AI on software development"

# 查看研究历史
librefang hand researcher history

# 生成报告
librefang hand researcher report --id <research-id>

Twitter Hand

自主社交媒体管理 Hand。

功能

  • 自动内容创作
  • 7 种内容格式
  • 审批队列
  • 自动发布
  • 互动回复

内容格式

  1. Thread - 长文推文串
  2. Hot Take - 热门观点
  3. Question - 社区问题
  4. Fact - 事实分享
  5. Quote - 引用推文
  6. Announcement - 产品公告
  7. Engagement - 互动推文

配置

[twitter]
content_formats = ["thread", "hot_take", "question"]
approval_queue = true
auto_schedule = true
posting_times = ["9:00", "12:00", "18:00"]

CLI 命令

# 激活 Twitter Hand
librefang hand activate twitter

# 创建内容
librefang hand twitter create --format thread --topic "AI trends"

# 查看审批队列
librefang hand twitter queue

# 批准推文
librefang hand twitter approve <tweet-id>

Browser Hand

Web 自动化 Hand。

功能

  • Playwright 驱动
  • 表单填写
  • 点击交互
  • 多步骤工作流
  • 购买审批 gate

配置

[browser]
headless = false
purchase_approval = true
screenshot_on_error = true
timeout = 30000

CLI 命令

# 激活 Browser Hand
librefang hand activate browser

# 执行自动化任务
librefang hand browser run --workflow "checkout-flow"

# 录制新工作流
librefang hand browser record --name "my-workflow"

# 列出工作流
librefang hand browser list

Hand 管理

CLI 命令

# 列出所有 Hands
librefang hand list

# 激活 Hand
librefang hand activate <hand-name>

# 暂停 Hand
librefang hand pause <hand-name>

# 查看状态
librefang hand status <hand-name>

# 查看日志
librefang hand logs <hand-name>

# 配置 Hand
librefang hand config <hand-name> --key <value>

Hand 状态

状态说明
Active运行中,按计划执行
Paused暂停,可恢复
Error发生错误,需要干预
Pending等待审批

创建自定义 Hand

Hand.toml 结构

name = "my-hand"
version = "1.0.0"
description = "Custom autonomous hand"

[schedule]
cron = "0 9 * * *"
timezone = "UTC"

[capabilities]
tools = ["web_fetch", "file_write"]
network = ["*"]

[config]
max_results = 100
timeout = 3600

[approval]
required = false
channels = ["telegram"]

实现代码

# hands/my-hand/main.py
async def execute(context: HandContext) -> HandResult:
    """Execute the hand's main logic"""

    # Fetch data
    data = await context.tools.web_fetch("https://api.example.com/data")

    # Process data
    results = process(data)

    # Store results
    await context.memory.store("hand_results", results)

    return HandResult(
        success=True,
        output=results,
        metadata={"count": len(results)}
    )

调度配置

Cron 表达式

[schedule]
# 每天 9 点
cron = "0 9 * * *"

# 工作日 9 点
cron = "0 9 * * 1-5"

# 每小时
cron = "0 * * * *"

# 每周一
cron = "0 9 * * 1"

时区

[schedule]
timezone = "Asia/Shanghai"

最佳实践

  1. 从简单开始 - 先使用单个 Hand
  2. 设置监控 - 定期检查 Hand 状态
  3. 配置告警 - 及时收到错误通知
  4. 审批流程 - 敏感操作需要审批
  5. 日志审查 - 定期审查执行日志

故障排除

Hand 不执行

# 检查 Hand 状态
librefang hand status <hand-name>

# 查看详细日志
librefang hand logs <hand-name> --level debug

# 手动触发执行
librefang hand run <hand-name>

错误处理

# 查看错误详情
librefang hand error <hand-name> --last

# 重置 Hand
librefang hand reset <hand-name>