跳到正文
Skillpedia
部署与云(DevOps)10k · #12033

deploy-agent

它能做什么

这个技能指导将 Bindu 智能体部署到本地、预发布或生产环境,并在过程中进行安全检查。适合使用 Bindu 构建智能体并需要发布它们的开发者。

适用场景

  • ✓你准备将 Bindu 智能体部署到本地、预发布或生产环境的时候。
  • ✓你希望在部署完成后运行健康检查的时候。
  • ✓你需要记录部署内容,并在部署失败时能够回滚的时候。

技能链接

https://github.com/GetBindu/Bindu/blob/main/.agents/skills/deploy-agent/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/GetBindu/Bindu/blob/main/.agents/skills/deploy-agent/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把我的 Bindu 智能体部署到预发布环境,运行检查,并告诉我它是否健康。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能先检查环境设置,并运行测试和部署前检查。然后部署智能体,运行健康检查,并写入部署记录。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Deploy Agent Skill

Overview

Deploy a Bindu agent to a target environment (local, staging, production) with comprehensive safety checks.

Inputs

  • Environment name (local, staging, production)
  • Agent configuration file path
  • Optional: deployment strategy (rolling, blue-green, canary)

Safety

  • Never deploy without passing tests
  • Verify environment variables before deployment
  • Run health checks after deployment
  • Generate deployment artifacts
  • Support rollback if deployment fails

Execution Contract

  1. Validate environment configuration
  2. Run pre-deployment checks
  3. Apply database migrations
  4. Deploy agent
  5. Verify deployment health
  6. Generate deployment record

Steps

1. Pre-Deployment Validation

# Check environment
ENVIRONMENT=$1
if [ -z "$ENVIRONMENT" ]; then
    echo "Error: Environment required (local, staging, production)"
    exit 1
fi

# Validate tests pass
echo "==> Running tests..."
uv run pytest || { echo "❌ Tests failed"; exit 1; }

# Validate pre-commit hooks
echo "==> Running pre-commit hooks..."
uv run pre-commit run --all-files || { echo "❌ Pre-commit hooks failed"; exit 1; }

# Check for uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
    echo "⚠️ Warning: Uncommitted changes detected"
    read -p "Continue anyway? (y/n) " -n 1 -r
    echo
    if [[ ! $REPLY =~ ^[Yy]$ ]]; then
        exit 1
    fi
fi

2. Environment Configuration

# Load environment-specific config
case $ENVIRONMENT in
    local)
        export STORAGE_BACKEND=memory
        export SCHEDULER_BACKEND=memory
        export PORT=3773
        ;;
    staging)
        export STORAGE_BACKEND=postgres
        export SCHEDULER_BACKEND=redis
        export DATABASE_URL=$STAGING_DATABASE_URL
        export REDIS_URL=$STAGING_REDIS_URL
        export PORT=3773
        ;;
    production)
        export STORAGE_BACKEND=postgres
        export SCHEDULER_BACKEND=redis
        export DATABASE_URL=$PROD_DATABASE_URL
        export REDIS_URL=$PROD_REDIS_URL
        export PORT=8080
        ;;
    *)
        echo "Error: Unknown environment $ENVIRONMENT"
        exit 1
        ;;
esac

# Verify required variables
required_vars=("STORAGE_BACKEND" "SCHEDULER_BACKEND")
for var in "${required_vars[@]}"; do
    if [ -z "${!var}" ]; then
        echo "Error: $var not set"
        exit 1
    fi
done

3. Database Migrations

# Run migrations for postgres backend
if [ "$STORAGE_BACKEND" = "postgres" ]; then
    echo "==> Running database migrations..."

    # Check current migration
    CURRENT=$(uv run alembic current 2>&1)
    echo "Current migration: $CURRENT"

    # Upgrade to head
    uv run alembic upgrade head || { echo "❌ Migration failed"; exit 1; }

    # Verify migration
    NEW_CURRENT=$(uv run alembic current 2>&1)
    echo "New migration: $NEW_CURRENT"
fi

4. Deploy Agent

# Local deployment
if [ "$ENVIRONMENT" = "local" ]; then
    echo "==> Starting local agent with tunnel..."
    uv run bindu serve --launch &
    AGENT_PID=$!
    echo "Agent PID: $AGENT_PID"
    sleep 5
fi

# Staging/Production deployment
if [ "$ENVIRONMENT" != "local" ]; then
    echo "==> Deploying to $ENVIRONMENT..."

    # Docker deployment
    if command -v docker &> /dev/null; then
        # Build image
        docker build -t bindu-agent:$ENVIRONMENT .

        # Stop old container
        docker stop bindu-agent-$ENVIRONMENT 2>/dev/null || true
        docker rm bindu-agent-$ENVIRONMENT 2>/dev/null || true

        # Start new container
        docker run -d \
            --name bindu-agent-$ENVIRONMENT \
            -p $PORT:8080 \
            -e DATABASE_URL="$DATABASE_URL" \
            -e REDIS_URL="$REDIS_URL" \
            -e STORAGE_BACKEND="$STORAGE_BACKEND" \
            -e SCHEDULER_BACKEND="$SCHEDULER_BACKEND" \
            bindu-agent:$ENVIRONMENT

        CONTAINER_ID=$(docker ps -qf "name=bindu-agent-$ENVIRONMENT")
        echo "Container ID: $CONTAINER_ID"
    else
        # Direct deployment
        uv run bindu serve &
        AGENT_PID=$!
        echo "Agent PID: $AGENT_PID"
    fi

    sleep 10
fi

5. Health Verification

# Determine health URL
if [ "$ENVIRONMENT" = "local" ]; then
    HEALTH_URL="http://localhost:3773/health"
else
    HEALTH_URL="http://localhost:$PORT/health"
fi

# Wait for agent to be ready
echo "==> Waiting for agent to be ready..."
MAX_RETRIES=30
RETRY_COUNT=0

while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
    
常见问题

如果测试失败,还会部署吗?

不会。这个技能说明,未通过测试就不能继续部署。

它提到了哪些部署策略?

它列出了滚动发布、蓝绿部署和金丝雀发布,供你选择。

如果部署失败会怎样?

这个技能说明,部署未成功时它支持回滚。

详情

作者的原始描述

Deploy Bindu agents to various environments with safety checks and verification

repo: GetBindu/Bindu

热度

GitHub 星标
10k
排名
#12033
许可证
—
更新时间
2026/9/6

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

相似技能