🚀 flyto-core
flyto-core 是一個可調試的自動化引擎,它能對每一步操作進行追蹤,並支持從任意點開始重放,極大提升了自動化流程的調試和執行效率。
🚀 快速開始
你可以在 30 秒內體驗 flyto-core:
pip install flyto-core[browser] && playwright install chromium
flyto recipe competitor-intel --url https://github.com/pricing
執行上述命令後,會看到如下執行結果:
Step 1/12 browser.launch ✓ 420ms
Step 2/12 browser.goto ✓ 1,203ms
Step 3/12 browser.evaluate ✓ 89ms
Step 4/12 browser.screenshot ✓ 1,847ms → saved intel-desktop.png
Step 5/12 browser.viewport ✓ 12ms → 390×844
Step 6/12 browser.screenshot ✓ 1,621ms → saved intel-mobile.png
Step 7/12 browser.viewport ✓ 8ms → 1280×720
Step 8/12 browser.performance ✓ 5,012ms → Web Vitals captured
Step 9/12 browser.evaluate ✓ 45ms
Step 10/12 browser.evaluate ✓ 11ms
Step 11/12 file.write ✓ 3ms → saved intel-report.json
Step 12/12 browser.close ✓ 67ms
✓ Done in 10.3s — 12/12 steps passed
執行完成後,會完成截圖捕獲、性能指標提取以及 JSON 報告保存,並且每一步操作都有詳細追蹤。
✨ 主要特性
- 執行追蹤:對每一步操作進行結構化記錄,包含輸入、輸出、時間和狀態。
- 重放功能:可使用原始(或修改後)的上下文從任意步驟重新執行。
- 斷點設置:能在任意步驟暫停執行,檢查狀態後繼續。
- 證據快照:在每個步驟邊界前後保存完整狀態。
- 數據溯源:跟蹤跨步驟的數據流,構建依賴圖。
- 超時保護:支持可配置的工作流級別和每步超時保護。
📦 安裝指南
pip install flyto-core
pip install flyto-core[browser]
playwright install chromium
💻 使用示例
基礎用法
以下是使用 flyto-core 進行競爭定價分析的示例:
name: Competitor Intel
steps:
- id: launch
module: browser.launch
- id: navigate
module: browser.goto
params: { url: "{{url}}" }
- id: prices
module: browser.evaluate
params:
script: |
JSON.stringify([
...document.querySelectorAll(
'[class*="price"]'
)
].map(e => e.textContent.trim()))
- id: desktop_shot
module: browser.screenshot
params: { path: desktop.png, full_page: true }
- id: mobile
module: browser.viewport
params: { width: 390, height: 844 }
- id: mobile_shot
module: browser.screenshot
params: { path: mobile.png, full_page: true }
- id: perf
module: browser.performance
- id: save
module: file.write
params:
path: report.json
content: "${prices.result}"
- id: close
module: browser.close
高級用法
當第 8 步執行失敗時,可使用以下命令從第 8 步開始重放:
flyto replay --from-step 8
這樣步驟 1 - 7 會立即執行,僅重新執行第 8 步,並且會保留完整上下文。
📚 詳細文檔
3 個立即嘗試的配方
flyto recipe competitor-intel --url https://competitor.com/pricing
flyto recipe full-audit --url https://your-site.com
flyto recipe scrape-to-csv --url https://news.ycombinator.com --selector ".titleline a"
每個配方都有執行追蹤,每次運行都可重放。查看所有 32 個配方 →
412 個模塊,78 個類別
| 類別 |
數量 |
示例 |
browser.* |
38 |
launch, goto, click, extract, screenshot, fill forms, wait |
flow.* |
24 |
switch, loop, branch, parallel, retry, circuit breaker, rate limit |
array.* |
15 |
filter, sort, map, reduce, unique, chunk, flatten |
string.* |
11 |
reverse, uppercase, split, replace, trim, slugify, template |
api.* |
11 |
OpenAI, Anthropic, Gemini, Notion, Slack, Telegram |
object.* |
10 |
keys, values, merge, pick, omit, get, set, flatten |
image.* |
9 |
resize, convert, crop, rotate, watermark, OCR, compress |
data.* |
8 |
json/xml/yaml/csv parse and generate |
file.* |
8 |
read, write, copy, move, delete, exists, edit, diff |
stats.* |
8 |
mean, median, percentile, correlation, standard deviation |
validate.* |
7 |
email, url, json, phone, credit card |
docker.* |
6 |
run, ps, logs, stop, build, inspect |
archive.* |
6 |
zip create/extract, tar create/extract, gzip, gunzip |
math.* |
6 |
calculate, round, ceil, floor, power, abs |
k8s.* |
5 |
get_pods, apply, logs, scale, describe |
crypto.* |
4 |
AES encrypt/decrypt, JWT create/verify |
network.* |
4 |
ping, traceroute, whois, port scan |
pdf.* |
4 |
parse, extract text, merge, compress |
aws.s3.* |
4 |
upload, download, list, delete |
google.* |
4 |
Gmail send/search, Calendar create/list events |
cache.* |
4 |
get, set, delete, clear (memory + Redis) |
ssh.* |
3 |
remote exec, SFTP upload, SFTP download |
git.* |
3 |
clone, commit, diff |
sandbox.* |
3 |
execute Python, Shell, JavaScript |
dns.* |
1 |
DNS lookup (A, AAAA, MX, CNAME, TXT, NS) |
monitor.* |
1 |
HTTP health check with SSL cert verification |
查看 完整模塊目錄 以獲取每個模塊、參數和描述的詳細信息。
與其他工具的區別
| 對比項 |
Playwright / Selenium |
Shell 腳本 |
flyto-core |
| 第 8 步失敗 |
重新運行整個流程 |
重新運行整個流程 |
flyto replay --from-step 8 |
| 第 3 步發生了什麼 |
添加 print() 並重新運行 |
添加 echo 並重新運行 |
完整追蹤:輸入、輸出、時間 |
| 瀏覽器、API 和文件 I/O |
編寫膠水代碼 |
使用 3 種語言 |
所有功能內置 |
| 與團隊共享 |
"克隆我的倉庫" |
"克隆我的倉庫" |
pip install flyto-core |
| 在 CI 中運行 |
用 pytest/bash 包裝 |
不穩定 |
flyto run workflow.yaml |
使用方式
CLI — 從終端運行工作流
flyto recipe site-audit --url https://example.com
flyto run my-workflow.yaml
flyto recipes
MCP Server — 適用於 Claude Code、Cursor、Windsurf
pip install flyto-core
claude mcp add flyto-core -- python -m core.mcp_server
或者添加到你的 MCP 配置中:
{
"mcpServers": {
"flyto-core": {
"command": "python",
"args": ["-m", "core.mcp_server"]
}
}
}
這樣你的 AI 就能將所有模塊作為工具使用。
HTTP API — 用於集成和遠程執行
pip install flyto-core[api]
flyto serve
| 端點 |
用途 |
POST /v1/workflow/run |
執行帶有證據和追蹤的工作流 |
POST /v1/workflow/{id}/replay/{step} |
從任意步驟重放 |
POST /v1/execute |
執行單個模塊 |
GET /v1/modules |
發現所有模塊 |
POST /mcp |
MCP 可流式 HTTP 傳輸 |
Python API — 用於編程式使用
import asyncio
from core.modules.registry import ModuleRegistry
async def main():
result = await ModuleRegistry.execute(
"string.reverse",
params={"text": "Hello"},
context={}
)
print(result)
asyncio.run(main())
30 + 內置配方
無需編寫代碼,每個配方都是一個 YAML 工作流模板:
flyto recipes
flyto recipe full-audit --url https://example.com
flyto recipe competitor-intel --url https://github.com/pricing
flyto recipe site-audit --url https://example.com
flyto recipe web-perf --url https://example.com
flyto recipe login-test --url https://myapp.com/login --username user --password pass --success_selector .dashboard
flyto recipe form-fill --url https://myapp.com/form --data '{"email":"test@example.com"}'
flyto recipe screenshot --url https://example.com
flyto recipe responsive-report --url https://example.com
flyto recipe page-to-pdf --url https://example.com
flyto recipe visual-snapshot --url https://example.com
flyto recipe webpage-archive --url https://example.com
flyto recipe scrape-page --url https://example.com --selector h1
flyto recipe scrape-links --url https://example.com
flyto recipe scrape-table --url https://en.wikipedia.org/wiki/YAML --selector .wikitable
flyto recipe stock-price --symbol AAPL
flyto recipe ocr --input scan.png
flyto recipe csv-to-json --input data.csv
flyto recipe image-resize --input photo.jpg --width 800
flyto recipe image-convert --input photo.png --format webp
flyto recipe port-scan --host example.com
flyto recipe whois --domain example.com
flyto recipe monitor-site --url https://myapp.com
flyto recipe docker-ps
flyto recipe git-changelog
flyto recipe scrape-to-slack --url https://example.com --selector h1 --webhook $SLACK_URL
flyto recipe github-issue --url https://example.com --owner me --repo my-app --title "Bug" --token $GITHUB_TOKEN
每個配方都是一個 YAML 工作流模板。運行 flyto recipe <name> --help 可查看完整選項。查看 docs/RECIPES.md 以獲取完整文檔。
編寫自己的工作流
配方只是 YAML 文件,你可以編寫自己的工作流:
name: price-monitor
steps:
- id: open
module: browser.launch
params: { headless: true }
- id: page
module: browser.goto
params: { url: "https://competitor.com/pricing" }
- id: prices
module: browser.evaluate
params:
script: |
JSON.stringify([...document.querySelectorAll('.price')].map(e => e.textContent))
- id: save
module: file.write
params: { path: "prices.json", content: "${prices.result}" }
- id: close
module: browser.close
flyto run price-monitor.yaml
每次運行都會生成執行追蹤和狀態快照。如果第 3 步失敗,可從第 3 步重放,無需重新運行整個流程。
模塊作者指南
from core.modules.registry import register_module
from core.modules.schema import compose, presets
@register_module(
module_id='string.reverse',
version='1.0.0',
category='string',
label='Reverse String',
description='Reverse the characters in a string',
params_schema=compose(presets.INPUT_TEXT(required=True)),
output_schema={'result': {'type': 'string', 'description': 'Reversed string'}},
)
async def string_reverse(context):
text = str(context['params']['text'])
return {'ok': True, 'data': {'result': text[::-1]}}
查看 模塊規範 以獲取完整指南。
貢獻代碼
我們歡迎貢獻!查看 CONTRIBUTING.md 以獲取貢獻指南。
安全問題
通過 security@flyto.dev 報告安全漏洞。查看 SECURITY.md 以獲取我們的安全策略。
📄 許可證
Apache 許可證 2.0 — 個人和商業使用均免費。
桌面 GUI 可在 flyto2.com 獲取。