EZ AI 管道
一个生产准备的CLI工具,用于使用AI模型执行即时优化管道. 具备了美丽的终端接口,多相相接管执行,成本效益高的模型选择,以及内置的网络仪表板.
特征
- 多站式管道: 定义具有多个AI处理阶段的复杂工作流程
- 有条件的执行: 跳过阶段,有条件运行,或根据结果提前退出
- 费用追踪: 所有 API 呼叫的自动令牌计数和成本计算
- 美丽的终端用户界面: 进度指标、旋转器和格式化产出
- 可变内插: 使用模板变量在各阶段之间传递数据
- 多个输出格式: JSON, Markdown, 和文本解析支持
- 暂停/恢复/取消: 实时控制管道执行
- 网页盘: 内置网络查看器以浏览管道输出
- 包括管道: 装有随时可以使用的管道的船舶(即时优化器、管道生成器)
安装
# Install globally from npm
npm install -g @ez-corp/ez-ai-pipeline
# Or use with npx
npx @ez-corp/ez-ai-pipeline --help
快速启动
1. 设置您的 API 密钥( 或使用 CLI 模式)
# Option A: Use your Anthropic API key
export ANTHROPIC_API_KEY="your-api-key"
# Option B: Use CLI mode with Claude Code (no API key needed)
# Just have Claude Code installed and authenticated
2. 运行包含的管道
ez-ai-pipeline run -p prompt-optimizer -i "Write a blog post about productivity"
3. 在网络仪表板上查看结果
ez-ai-pipeline web
4. 创建自己的管道
ez-ai-pipeline init my-pipeline
图标
run - 执行管道
ez-ai-pipeline run --pipeline <id> --input <text>
ez-ai-pipeline run --pipeline <id> --input-file <path>
ez-ai-pipeline run --pipeline <id> --input <text> --output ./results/
ez-ai-pipeline run --pipeline <id> --input <text> --json # JSON output only
ez-ai-pipeline run --pipeline <id> --input <text> --quiet # Minimal output
list - 显示可用的管道
ez-ai-pipeline list
ez-ai-pipeline list --json
validate - 验证管道配置
ez-ai-pipeline validate --pipeline <id>
init - 从模板创建新管道
ez-ai-pipeline init <name>
web - 启动网络仪表板
ez-ai-pipeline web # Start on default port 3000
ez-ai-pipeline web -p 8080 # Start on custom port
打开本地网络界面浏览管道,并在浏览器中直接执行.
特征 :
- 运行管道: 执行任何有实时进度跟踪的管道
- 现场进展: 完成WebSocket功能更新的监视阶段
- 费用追踪: 在每个阶段完成时参见成本累积
- 查看产出: 浏览所有管道执行结果
- 阶段细节: 探索分阶段产出和配置
- CLI 模式: 使用 Claude 代码、 OpenCode 或 Aider 而不是 API 密钥
执行模式 :
- API 模式: 使用您的 Anthropic API 密钥( 在 ATHROPIC API KEY 设定时默认)
- CLI 模式: shells out to Claude Code, OpenCode, 或 Aider (不需要 API 密钥)
仪表板自动检测器安装了 CLI 工具, 并允许您选择首选的执行模式 .
从网络运行管道 :
- 启动网络仪表板 :
ez-ai-pipeline web - 从边栏导航到管道
- 使用 CLI 模式选择执行模式( API 或 CLI) 和工具
- 在文本区域输入您的提示
- 点击“运行管道”或按
Ctrl+Enter - 在每个阶段执行时观察实时进度
- 查看最终优化的输出
键盘快捷键 :
Ctrl+Enter- 运行管道Escape- 取消运行中的执行
包括管道
装有随时可以使用的管道的邮轮:
prompt-optimizer
优化推动AI更好回应. 分析输入,识别改进,并生成增强版本.
ez-ai-pipeline run -p prompt-optimizer -i "Your prompt to optimize"
pipeline-generator
从自然语言描述中生成新的管道配置.
ez-ai-pipeline run -p pipeline-generator -i "Create a pipeline that summarizes articles"
管道配置
管道是类型脚本文件 pipelines/ 目录 :
import type { PipelineConfig } from "../src/typings/pipeline.ts";
const config: PipelineConfig = {
pipeline: {
id: "my-pipeline",
name: "My Pipeline",
version: "1.0.0",
description: "Description of what this pipeline does",
settings: {
enableCaching: true,
enableEarlyExit: true,
maxRetries: 2,
timeoutMs: 300000,
},
},
stages: [
{
id: "stage-1",
name: "Analyze Input",
type: "analyze",
model: {
providerID: "anthropic",
modelID: "claude-haiku-4-5-20251001",
tier: "small",
maxTokens: 1024,
temperature: 0.1,
},
prompt: {
systemPrompt: "You are an expert analyst.",
template: `Analyze this: {{input_prompt}}`,
variables: [
{ name: "input_prompt", source: "input", path: "prompt", required: true },
],
},
output: {
format: "json",
extract: [
{ name: "result", path: "result", required: true },
],
},
},
],
};
export default config;
阶段类型
analyze- 分析和提取信息structure- 调整或组织内容enhance- 改进或丰富内容validate- 根据标准验证结果test- 测试产出或运行检查iterate- 进行反复改进custom- 自定义处理阶段
可变源
变量可以来自:
input- 管道的原始输入previousStage- 前一个阶段的产出context- 整个管道的累积背景static- 在配置中定义的静态值
条件
跳过如果
满足条件时跳过一个阶段 :
conditions: {
skipIf: {
condition: { path: "status", equals: "complete" },
sourceStage: "stage-1",
},
}
运行如果
仅在满足条件的情况下运行一个舞台:
conditions: {
runIf: {
condition: { path: "needsWork", equals: true },
sourceStage: "stage-1",
},
}
提前退出
如果满足条件,则提前退出管道:
conditions: {
earlyExit: {
condition: { path: "overall", equals: "COMPLETE" },
returnStage: "stage-1",
},
}
产出
结果被保存到 outputs/ 目录 :
result-{pipeline}-{timestamp}.json- 全部编审结果prompt-{pipeline}-{timestamp}.md- 优化快速(快速管道)
网络 API
网络仪表板显示一个 REST API 和 WebSocket 程序访问端点:
REST 终点
| 方法 | 终点 | 说明 |
|---|---|---|
| 获取 | /api/pipelines | 列出所有可用的管道 |
| 获取 | /api/pipelines/:id | 获取管道配置 |
| 邮政 | /api/pipelines/:id/run | 启动管道执行 |
| 获取 | /api/executions/:id | 获取执行状态 |
| 邮政 | /api/executions/:id/cancel | 取消运行中的执行 |
| 获取 | /api/outputs | 列出全部执行产出 |
| 获取 | /api/outputs/:filename | 获取特定输出文件 |
| 获取 | /api/config/status | 检查是否配置了 API 密钥 |
通过 API 运行管道
# Start execution
curl -X POST http://localhost:3000/api/pipelines/prompt-optimizer/run \
-H "Content-Type: application/json" \
-d '{"input": "Your prompt to optimize"}'
# Response: { "executionId": "exec_123...", "pipelineId": "prompt-optimizer", "status": "started" }
# Check status
curl http://localhost:3000/api/executions/exec_123...
# Cancel execution
curl -X POST http://localhost:3000/api/executions/exec_123.../cancel
实时更新的 WebSocket
连接到 ws://localhost:3000/ws 实时执行进度:
const ws = new WebSocket('ws://localhost:3000/ws');
// Subscribe to an execution
ws.send(JSON.stringify({ type: 'subscribe', executionId: 'exec_123...' }));
// Receive events
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
// Event types: stage:started, stage:completed, stage:failed,
// stage:skipped, execution:completed, execution:cancelled
console.log(data);
};
发展
# Run tests
bun test
# Type check
bun run typecheck
# Format code
bun run format
项目结构
ez-ai-pipeline/
├── src/
│ ├── index.ts # CLI entry point
│ ├── cli/ # CLI commands and UI
│ │ └── commands/ # Command implementations (run, list, validate, init, web)
│ ├── core/ # Pipeline execution engine
│ ├── schema/ # Zod schemas and validation
│ ├── typings/ # TypeScript type definitions
│ ├── utils/ # Utilities (cost, templates, etc.)
│ └── config/ # Configuration and constants
├── pipelines/ # Included pipeline definitions
├── web/ # Web dashboard source
├── web-dist/ # Built web assets (included in npm package)
├── outputs/ # Generated outputs
├── tests/ # Test files
└── package.json
支持的模式
安东尼
- claude-opus-4-5-20250929(大号)
- claude-sonnet-4-5-20250929(中型)
- 克来德-海库-4-5-20251001(小)
开放AI
- gpt-4o(中层)
- gpt-4o-mini( 小号)
- gpt-4-涡轮(大)
谷歌
- gemini-1.5-正(大)
- 遗传1.5-发光(小)
- 双发( 小)
许可证
麻省理工学院执照 - 看 自由主义 详细情况.
捐款
见 捐款额 捐款准则.