简介
基于inference.sh CLI构建自动化AI工作流,支持批量处理、定时任务、事件驱动管道等模式,适合规模化内容生成与数据处理场景。
原始描述
Build automated AI workflows combining multiple models and services. Patterns: batch processing, scheduled tasks, event-driven pipelines, agent loops. Tools:...
通过你的 Agent 添加
安装目录:ai-automation-workflows/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
AI Automation Workflows 是一套基于 inference.sh CLI 的自动化工作流构建方案,主要面向需要规模化、自动化运行 AI 任务的用户。核心能力包括:
主要功能模式
- 批量处理(Batch Processing) — 循环处理多个输入,如批量生成图片
- 顺序流水线(Sequential Pipeline) — 多模型串联,如「搜索→写作→配图→社媒文案」
- 并行处理(Parallel Processing) — 后台并发执行多个任务
- 条件分支(Conditional Workflow) — 基于 AI 分析结果动态选择执行路径
- 重试与降级(Retry with Fallback) — 失败自动重试,超时切换备用模型
技术实现方式
- Bash 脚本:原生 shell 脚本 +
infsh CLI 命令
- Python SDK:通过
subprocess 调用 CLI(示例提供封装函数)
- 定时任务:结合
cron 实现每日/每周自动化内容生成
- 监控告警:支持日志记录、执行时间追踪、失败 webhook 通知
典型应用场景
- 社交媒体内容日历自动化(每日生成配图+文案)
- 数据报告自动化(定时搜索→分析→生成可视化)
- 批量图片/视频生成(电商素材、营销物料)
- AI Agent 循环工作流(监控→决策→执行→反馈)
显著优点
- 开箱即用的代码模板:5 种核心模式均有完整可运行的 Bash/Python 示例
- 灵活的编排能力:支持顺序、并行、条件分支、重试等复杂逻辑
- 无服务器依赖:基于 CLI 工具,可在任何 Linux/macOS/Windows 环境运行
- 多模型兼容:可自由组合 Fal.ai、OpenRouter、Tavily 等平台的模型
- 生产级实践:包含速率限制、指数退避、日志记录、错误告警等细节
潜在缺点与局限性
- CLI 依赖较重:Python 示例仍通过
subprocess 调用命令行,非原生 SDK 集成
- 错误处理偏基础:部分示例的异常处理较简单,需用户自行加固
- 无状态管理:工作流状态需自行持久化(文件/数据库),无内置追踪
- 平台锁定:深度依赖 inference.sh 生态,迁移成本需评估
- T3 来源可信度:当前为个人/社区维护项目,企业级合规审计需补充
适合人群
用户类型
适用场景
独立开发者/创作者
个人博客、社交媒体的内容自动化
小型团队运营
批量生成营销素材、定时报告
技术型 PM/增长
快速搭建 MVP 自动化 pipeline
DevOps/SRE
将 AI 能力集成到现有 CI/CD 或监控体系
常规风险
- 供应链安全:
curl | sh 安装模式存在中间人攻击风险(文档已补充 SHA-256 校验说明)
- API 成本失控:自动化任务若未加限制,可能因高频调用产生意外费用
- 内容合规:批量生成内容需人工审核,避免版权、虚假信息传播
- 密钥管理:生产环境需妥善保管
infsh login 凭证,避免硬编码
- 服务可用性:依赖外部 API 稳定性,需设计熔断降级机制
- Bash 脚本:原生 shell 脚本 +
infshCLI 命令 - Python SDK:通过
subprocess调用 CLI(示例提供封装函数) - 定时任务:结合
cron实现每日/每周自动化内容生成 - 监控告警:支持日志记录、执行时间追踪、失败 webhook 通知
典型应用场景
- 社交媒体内容日历自动化(每日生成配图+文案)
- 数据报告自动化(定时搜索→分析→生成可视化)
- 批量图片/视频生成(电商素材、营销物料)
- AI Agent 循环工作流(监控→决策→执行→反馈)
显著优点
- 开箱即用的代码模板:5 种核心模式均有完整可运行的 Bash/Python 示例
- 灵活的编排能力:支持顺序、并行、条件分支、重试等复杂逻辑
- 无服务器依赖:基于 CLI 工具,可在任何 Linux/macOS/Windows 环境运行
- 多模型兼容:可自由组合 Fal.ai、OpenRouter、Tavily 等平台的模型
- 生产级实践:包含速率限制、指数退避、日志记录、错误告警等细节
潜在缺点与局限性
- CLI 依赖较重:Python 示例仍通过
subprocess 调用命令行,非原生 SDK 集成
- 错误处理偏基础:部分示例的异常处理较简单,需用户自行加固
- 无状态管理:工作流状态需自行持久化(文件/数据库),无内置追踪
- 平台锁定:深度依赖 inference.sh 生态,迁移成本需评估
- T3 来源可信度:当前为个人/社区维护项目,企业级合规审计需补充
适合人群
用户类型
适用场景
独立开发者/创作者
个人博客、社交媒体的内容自动化
小型团队运营
批量生成营销素材、定时报告
技术型 PM/增长
快速搭建 MVP 自动化 pipeline
DevOps/SRE
将 AI 能力集成到现有 CI/CD 或监控体系
常规风险
- 供应链安全:
curl | sh 安装模式存在中间人攻击风险(文档已补充 SHA-256 校验说明)
- API 成本失控:自动化任务若未加限制,可能因高频调用产生意外费用
- 内容合规:批量生成内容需人工审核,避免版权、虚假信息传播
- 密钥管理:生产环境需妥善保管
infsh login 凭证,避免硬编码
- 服务可用性:依赖外部 API 稳定性,需设计熔断降级机制
- 开箱即用的代码模板:5 种核心模式均有完整可运行的 Bash/Python 示例
- 灵活的编排能力:支持顺序、并行、条件分支、重试等复杂逻辑
- 无服务器依赖:基于 CLI 工具,可在任何 Linux/macOS/Windows 环境运行
- 多模型兼容:可自由组合 Fal.ai、OpenRouter、Tavily 等平台的模型
- 生产级实践:包含速率限制、指数退避、日志记录、错误告警等细节
潜在缺点与局限性
- CLI 依赖较重:Python 示例仍通过
subprocess 调用命令行,非原生 SDK 集成
- 错误处理偏基础:部分示例的异常处理较简单,需用户自行加固
- 无状态管理:工作流状态需自行持久化(文件/数据库),无内置追踪
- 平台锁定:深度依赖 inference.sh 生态,迁移成本需评估
- T3 来源可信度:当前为个人/社区维护项目,企业级合规审计需补充
适合人群
用户类型
适用场景
独立开发者/创作者
个人博客、社交媒体的内容自动化
小型团队运营
批量生成营销素材、定时报告
技术型 PM/增长
快速搭建 MVP 自动化 pipeline
DevOps/SRE
将 AI 能力集成到现有 CI/CD 或监控体系
常规风险
- 供应链安全:
curl | sh 安装模式存在中间人攻击风险(文档已补充 SHA-256 校验说明)
- API 成本失控:自动化任务若未加限制,可能因高频调用产生意外费用
- 内容合规:批量生成内容需人工审核,避免版权、虚假信息传播
- 密钥管理:生产环境需妥善保管
infsh login 凭证,避免硬编码
- 服务可用性:依赖外部 API 稳定性,需设计熔断降级机制
subprocess 调用命令行,非原生 SDK 集成| 用户类型 | 适用场景 |
|---|---|
| 独立开发者/创作者 | 个人博客、社交媒体的内容自动化 |
| 小型团队运营 | 批量生成营销素材、定时报告 |
| 技术型 PM/增长 | 快速搭建 MVP 自动化 pipeline |
| DevOps/SRE | 将 AI 能力集成到现有 CI/CD 或监控体系 |
常规风险
- 供应链安全:
curl | sh 安装模式存在中间人攻击风险(文档已补充 SHA-256 校验说明)
- API 成本失控:自动化任务若未加限制,可能因高频调用产生意外费用
- 内容合规:批量生成内容需人工审核,避免版权、虚假信息传播
- 密钥管理:生产环境需妥善保管
infsh login 凭证,避免硬编码
- 服务可用性:依赖外部 API 稳定性,需设计熔断降级机制
curl | sh 安装模式存在中间人攻击风险(文档已补充 SHA-256 校验说明)infsh login 凭证,避免硬编码技能正文
name: ai-automation-workflows
description: "Build automated AI workflows combining multiple models and services. Patterns: batch processing, scheduled tasks, event-driven pipelines, agent loops. Tools: inference.sh CLI, bash scripting, Python SDK, webhook integration. Use for: content automation, data processing, monitoring, scheduled generation. Triggers: ai automation, workflow automation, batch processing, ai pipeline, automated content, scheduled ai, ai cron, ai batch job, automated generation, ai workflow, content at scale, automation script, ai orchestration"
allowed-tools: Bash(infsh *)
AI Automation Workflows
Build automated AI workflows via inference.sh CLI.

Quick Start
curl -fsSL https://cli.inference.sh | sh && infsh login
# Simple automation: Generate daily image
infsh app run falai/flux-dev --input '{
"prompt": "Inspirational quote background, minimalist design, date: '"$(date +%Y-%m-%d)"'"
}'
Install note: The install script only detects your OS/architecture, downloads the matching binary from dist.inference.sh, and verifies its SHA-256 checksum. No elevated permissions or background processes. Manual install & verification available.
Automation Patterns
Pattern 1: Batch Processing
curl -fsSL https://cli.inference.sh | sh && infsh login
# Simple automation: Generate daily image
infsh app run falai/flux-dev --input '{
"prompt": "Inspirational quote background, minimalist design, date: '"$(date +%Y-%m-%d)"'"
}'
Install note: The install script only detects your OS/architecture, downloads the matching binary from dist.inference.sh, and verifies its SHA-256 checksum. No elevated permissions or background processes. Manual install & verification available.
Pattern 1: Batch Processing
Process multiple items with the same workflow.
#!/bin/bash
# batch_images.sh - Generate images for multiple prompts
PROMPTS=(
"Mountain landscape at sunrise"
"Ocean waves at sunset"
"Forest path in autumn"
"Desert dunes at night"
)
for prompt in "${PROMPTS[@]}"; do
echo "Generating: $prompt"
infsh app run falai/flux-dev --input "{
\"prompt\": \"$prompt, professional photography, 4K\"
}" > "output_${prompt// /_}.json"
sleep 2 # Rate limiting
done
Pattern 2: Sequential Pipeline
Chain multiple AI operations.
#!/bin/bash
# content_pipeline.sh - Full content creation pipeline
TOPIC="AI in healthcare"
# Step 1: Research
echo "Researching..."
RESEARCH=$(infsh app run tavily/search-assistant --input "{
\"query\": \"$TOPIC latest developments\"
}")
# Step 2: Write article
echo "Writing article..."
ARTICLE=$(infsh app run openrouter/claude-sonnet-45 --input "{
\"prompt\": \"Write a 500-word blog post about $TOPIC based on: $RESEARCH\"
}")
# Step 3: Generate image
echo "Generating image..."
IMAGE=$(infsh app run falai/flux-dev --input "{
\"prompt\": \"Blog header image for article about $TOPIC, modern, professional\"
}")
# Step 4: Generate social post
echo "Creating social post..."
SOCIAL=$(infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Write a Twitter thread (5 tweets) summarizing: $ARTICLE\"
}")
echo "Pipeline complete!"
Pattern 3: Parallel Processing
Run multiple operations simultaneously.
#!/bin/bash
# parallel_generation.sh - Generate multiple assets in parallel
# Start all jobs in background
infsh app run falai/flux-dev --input '{"prompt": "Hero image..."}' > hero.json &
PID1=$!
infsh app run falai/flux-dev --input '{"prompt": "Feature image 1..."}' > feature1.json &
PID2=$!
infsh app run falai/flux-dev --input '{"prompt": "Feature image 2..."}' > feature2.json &
PID3=$!
# Wait for all to complete
wait $PID1 $PID2 $PID3
echo "All images generated!"
Pattern 4: Conditional Workflow
Branch based on results.
#!/bin/bash
# conditional_workflow.sh - Process based on content analysis
INPUT_TEXT="$1"
# Analyze content
ANALYSIS=$(infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Classify this text as: positive, negative, or neutral. Return only the classification.\n\n$INPUT_TEXT\"
}")
# Branch based on result
case "$ANALYSIS" in
*positive*)
echo "Generating celebration image..."
infsh app run falai/flux-dev --input '{"prompt": "Celebration, success, happy"}'
;;
*negative*)
echo "Generating supportive message..."
infsh app run openrouter/claude-sonnet-45 --input "{
\"prompt\": \"Write a supportive, encouraging response to: $INPUT_TEXT\"
}"
;;
*)
echo "Generating neutral acknowledgment..."
;;
esac
Pattern 5: Retry with Fallback
Handle failures gracefully.
#!/bin/bash
# retry_workflow.sh - Retry failed operations
generate_with_retry() {
local prompt="$1"
local max_attempts=3
local attempt=1
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt..."
result=$(infsh app run falai/flux-dev --input "{\"prompt\": \"$prompt\"}" 2>&1)
if [ $? -eq 0 ]; then
echo "$result"
return 0
fi
echo "Failed, retrying..."
((attempt++))
sleep $((attempt * 2)) # Exponential backoff
done
# Fallback to different model
echo "Falling back to alternative model..."
infsh app run google/imagen-3 --input "{\"prompt\": \"$prompt\"}"
}
generate_with_retry "A beautiful sunset over mountains"
Scheduled Automation
Cron Job Setup
# Edit crontab
crontab -e
# Daily content generation at 9 AM
0 9 * * * /path/to/daily_content.sh >> /var/log/ai-automation.log 2>&1
# Weekly report every Monday at 8 AM
0 8 * * 1 /path/to/weekly_report.sh >> /var/log/ai-automation.log 2>&1
# Every 6 hours: social media content
0 */6 * * * /path/to/social_content.sh >> /var/log/ai-automation.log 2>&1
Daily Content Script
#!/bin/bash
# daily_content.sh - Run daily at 9 AM
DATE=$(date +%Y-%m-%d)
OUTPUT_DIR="/output/$DATE"
mkdir -p "$OUTPUT_DIR"
# Generate daily quote image
infsh app run falai/flux-dev --input '{
"prompt": "Motivational quote background, minimalist, morning vibes"
}' > "$OUTPUT_DIR/quote_image.json"
# Generate daily tip
infsh app run openrouter/claude-haiku-45 --input '{
"prompt": "Give me one actionable productivity tip for today. Be concise."
}' > "$OUTPUT_DIR/daily_tip.json"
# Post to social (optional)
# infsh app run twitter/post-tweet --input "{...}"
echo "Daily content generated: $DATE"
Monitoring and Logging
Logging Wrapper
#!/bin/bash
# logged_workflow.sh - With comprehensive logging
LOG_FILE="/var/log/ai-workflow-$(date +%Y%m%d).log"
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}
log "Starting workflow"
# Track execution time
START_TIME=$(date +%s)
# Run workflow
log "Generating image..."
RESULT=$(infsh app run falai/flux-dev --input '{"prompt": "test"}' 2>&1)
STATUS=$?
if [ $STATUS -eq 0 ]; then
log "Success: Image generated"
else
log "Error: $RESULT"
fi
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
log "Completed in ${DURATION}s"
Error Alerting
#!/bin/bash
# monitored_workflow.sh - With error alerts
run_with_alert() {
local result
result=$("$@" 2>&1)
local status=$?
if [ $status -ne 0 ]; then
# Send alert (webhook, email, etc.)
curl -X POST "https://your-webhook.com/alert" \
-H "Content-Type: application/json" \
-d "{\"error\": \"$result\", \"command\": \"$*\"}"
fi
echo "$result"
return $status
}
run_with_alert infsh app run falai/flux-dev --input '{"prompt": "test"}'
Python SDK Automation
#!/usr/bin/env python3
# automation.py - Python-based workflow
import subprocess
import json
from datetime import datetime
from pathlib import Path
def run_infsh(app_id: str, input_data: dict) -> dict:
"""Run inference.sh app and return result."""
result = subprocess.run(
["infsh", "app", "run", app_id, "--input", json.dumps(input_data)],
capture_output=True,
text=True
)
return json.loads(result.stdout) if result.returncode == 0 else None
def daily_content_pipeline():
"""Generate daily content."""
date_str = datetime.now().strftime("%Y-%m-%d")
output_dir = Path(f"output/{date_str}")
output_dir.mkdir(parents=True, exist_ok=True)
# Generate image
image = run_infsh("falai/flux-dev", {
"prompt": f"Daily inspiration for {date_str}, beautiful, uplifting"
})
(output_dir / "image.json").write_text(json.dumps(image))
# Generate caption
caption = run_infsh("openrouter/claude-haiku-45", {
"prompt": "Write an inspiring caption for a daily motivation post. 2-3 sentences."
})
(output_dir / "caption.json").write_text(json.dumps(caption))
print(f"Generated content for {date_str}")
if __name__ == "__main__":
daily_content_pipeline()
Workflow Templates
Content Calendar Automation
#!/bin/bash
# content_calendar.sh - Generate week of content
TOPICS=("productivity" "wellness" "technology" "creativity" "leadership")
DAYS=("Monday" "Tuesday" "Wednesday" "Thursday" "Friday")
for i in "${!DAYS[@]}"; do
DAY=${DAYS[$i]}
TOPIC=${TOPICS[$i]}
echo "Generating $DAY content about $TOPIC..."
# Image
infsh app run falai/flux-dev --input "{
\"prompt\": \"$TOPIC theme, $DAY motivation, social media style\"
}" > "content/${DAY}_image.json"
# Caption
infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Write a $DAY motivation post about $TOPIC. Include hashtags.\"
}" > "content/${DAY}_caption.json"
done
Data Processing Pipeline
#!/bin/bash
# data_processing.sh - Process and analyze data files
INPUT_DIR="./data/raw"
OUTPUT_DIR="./data/processed"
for file in "$INPUT_DIR"/*.txt; do
filename=$(basename "$file" .txt)
# Analyze content
infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Analyze this data and provide key insights in JSON format: $(cat $file)\"
}" > "$OUTPUT_DIR/${filename}_analysis.json"
done
Best Practices
- Rate limiting - Add delays between API calls
- Error handling - Always check return codes
- Logging - Track all operations
- Idempotency - Design for safe re-runs
- Monitoring - Alert on failures
- Backups - Save intermediate results
- Timeouts - Set reasonable limits
Related Skills
# Content pipelines
npx skills add inference-sh/skills@ai-content-pipeline
# RAG pipelines
npx skills add inference-sh/skills@ai-rag-pipeline
# Social media automation
npx skills add inference-sh/skills@ai-social-media-content
# Full platform skill
npx skills add inference-sh/skills@inference-sh
#!/bin/bash
# daily_content.sh - Run daily at 9 AM
DATE=$(date +%Y-%m-%d)
OUTPUT_DIR="/output/$DATE"
mkdir -p "$OUTPUT_DIR"
# Generate daily quote image
infsh app run falai/flux-dev --input '{
"prompt": "Motivational quote background, minimalist, morning vibes"
}' > "$OUTPUT_DIR/quote_image.json"
# Generate daily tip
infsh app run openrouter/claude-haiku-45 --input '{
"prompt": "Give me one actionable productivity tip for today. Be concise."
}' > "$OUTPUT_DIR/daily_tip.json"
# Post to social (optional)
# infsh app run twitter/post-tweet --input "{...}"
echo "Daily content generated: $DATE"
Logging Wrapper
#!/bin/bash
# logged_workflow.sh - With comprehensive logging
LOG_FILE="/var/log/ai-workflow-$(date +%Y%m%d).log"
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}
log "Starting workflow"
# Track execution time
START_TIME=$(date +%s)
# Run workflow
log "Generating image..."
RESULT=$(infsh app run falai/flux-dev --input '{"prompt": "test"}' 2>&1)
STATUS=$?
if [ $STATUS -eq 0 ]; then
log "Success: Image generated"
else
log "Error: $RESULT"
fi
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
log "Completed in ${DURATION}s"
#!/bin/bash
# monitored_workflow.sh - With error alerts
run_with_alert() {
local result
result=$("$@" 2>&1)
local status=$?
if [ $status -ne 0 ]; then
# Send alert (webhook, email, etc.)
curl -X POST "https://your-webhook.com/alert" \
-H "Content-Type: application/json" \
-d "{\"error\": \"$result\", \"command\": \"$*\"}"
fi
echo "$result"
return $status
}
run_with_alert infsh app run falai/flux-dev --input '{"prompt": "test"}'
Python SDK Automation
#!/usr/bin/env python3
# automation.py - Python-based workflow
import subprocess
import json
from datetime import datetime
from pathlib import Path
def run_infsh(app_id: str, input_data: dict) -> dict:
"""Run inference.sh app and return result."""
result = subprocess.run(
["infsh", "app", "run", app_id, "--input", json.dumps(input_data)],
capture_output=True,
text=True
)
return json.loads(result.stdout) if result.returncode == 0 else None
def daily_content_pipeline():
"""Generate daily content."""
date_str = datetime.now().strftime("%Y-%m-%d")
output_dir = Path(f"output/{date_str}")
output_dir.mkdir(parents=True, exist_ok=True)
# Generate image
image = run_infsh("falai/flux-dev", {
"prompt": f"Daily inspiration for {date_str}, beautiful, uplifting"
})
(output_dir / "image.json").write_text(json.dumps(image))
# Generate caption
caption = run_infsh("openrouter/claude-haiku-45", {
"prompt": "Write an inspiring caption for a daily motivation post. 2-3 sentences."
})
(output_dir / "caption.json").write_text(json.dumps(caption))
print(f"Generated content for {date_str}")
if __name__ == "__main__":
daily_content_pipeline()
Workflow Templates
Content Calendar Automation
#!/bin/bash
# content_calendar.sh - Generate week of content
TOPICS=("productivity" "wellness" "technology" "creativity" "leadership")
DAYS=("Monday" "Tuesday" "Wednesday" "Thursday" "Friday")
for i in "${!DAYS[@]}"; do
DAY=${DAYS[$i]}
TOPIC=${TOPICS[$i]}
echo "Generating $DAY content about $TOPIC..."
# Image
infsh app run falai/flux-dev --input "{
\"prompt\": \"$TOPIC theme, $DAY motivation, social media style\"
}" > "content/${DAY}_image.json"
# Caption
infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Write a $DAY motivation post about $TOPIC. Include hashtags.\"
}" > "content/${DAY}_caption.json"
done
Data Processing Pipeline
#!/usr/bin/env python3
# automation.py - Python-based workflow
import subprocess
import json
from datetime import datetime
from pathlib import Path
def run_infsh(app_id: str, input_data: dict) -> dict:
"""Run inference.sh app and return result."""
result = subprocess.run(
["infsh", "app", "run", app_id, "--input", json.dumps(input_data)],
capture_output=True,
text=True
)
return json.loads(result.stdout) if result.returncode == 0 else None
def daily_content_pipeline():
"""Generate daily content."""
date_str = datetime.now().strftime("%Y-%m-%d")
output_dir = Path(f"output/{date_str}")
output_dir.mkdir(parents=True, exist_ok=True)
# Generate image
image = run_infsh("falai/flux-dev", {
"prompt": f"Daily inspiration for {date_str}, beautiful, uplifting"
})
(output_dir / "image.json").write_text(json.dumps(image))
# Generate caption
caption = run_infsh("openrouter/claude-haiku-45", {
"prompt": "Write an inspiring caption for a daily motivation post. 2-3 sentences."
})
(output_dir / "caption.json").write_text(json.dumps(caption))
print(f"Generated content for {date_str}")
if __name__ == "__main__":
daily_content_pipeline()
Content Calendar Automation
#!/bin/bash
# content_calendar.sh - Generate week of content
TOPICS=("productivity" "wellness" "technology" "creativity" "leadership")
DAYS=("Monday" "Tuesday" "Wednesday" "Thursday" "Friday")
for i in "${!DAYS[@]}"; do
DAY=${DAYS[$i]}
TOPIC=${TOPICS[$i]}
echo "Generating $DAY content about $TOPIC..."
# Image
infsh app run falai/flux-dev --input "{
\"prompt\": \"$TOPIC theme, $DAY motivation, social media style\"
}" > "content/${DAY}_image.json"
# Caption
infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Write a $DAY motivation post about $TOPIC. Include hashtags.\"
}" > "content/${DAY}_caption.json"
done
#!/bin/bash
# data_processing.sh - Process and analyze data files
INPUT_DIR="./data/raw"
OUTPUT_DIR="./data/processed"
for file in "$INPUT_DIR"/*.txt; do
filename=$(basename "$file" .txt)
# Analyze content
infsh app run openrouter/claude-haiku-45 --input "{
\"prompt\": \"Analyze this data and provide key insights in JSON format: $(cat $file)\"
}" > "$OUTPUT_DIR/${filename}_analysis.json"
done
Best Practices
- Rate limiting - Add delays between API calls
- Error handling - Always check return codes
- Logging - Track all operations
- Idempotency - Design for safe re-runs
- Monitoring - Alert on failures
- Backups - Save intermediate results
- Timeouts - Set reasonable limits
Related Skills
# Content pipelines
npx skills add inference-sh/skills@ai-content-pipeline
# RAG pipelines
npx skills add inference-sh/skills@ai-rag-pipeline
# Social media automation
npx skills add inference-sh/skills@ai-social-media-content
# Full platform skill
npx skills add inference-sh/skills@inference-sh
# Content pipelines
npx skills add inference-sh/skills@ai-content-pipeline
# RAG pipelines
npx skills add inference-sh/skills@ai-rag-pipeline
# Social media automation
npx skills add inference-sh/skills@ai-social-media-content
# Full platform skill
npx skills add inference-sh/skills@inference-sh
Browse all apps: infsh app list
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。