> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 国际象棋对战

Chess Battle 是一款国际象棋应用程序，其中多个 AI 代理协同玩国际象棋，展示了多代理系统在复杂游戏环境中的强大功能。

### 主要功能

* 多代理系统：设有白棋子代理和黑棋子代理来进行走子选择
* 走子校验：专门的合法走子代理确保符合游戏规则
* 游戏协调：主代理负责管理游戏流程和结束条件
* 交互式用户界面：使用 Streamlit 构建，用于实时游戏可视化

<video autoPlay muted controls className="w-full aspect-video" src="https://mintcdn.com/ikun/fXmeJ7wKTC-4Xav-/videos/chess-team.mp4?fit=max&auto=format&n=fXmeJ7wKTC-4Xav-&q=85&s=632d85c550c859f2107bf6854dba0055" data-path="videos/chess-team.mp4" />

### 系统组件

* 白棋子代理：为白棋子制定策略并选择走子
* 黑棋子代理：控制黑棋子并决定走子
* 合法走子代理：根据国际象棋规则校验所有 প্রস্তাবিত 走子
* 主代理：协调游戏流程并监控游戏状态

### 高级功能

该系统展示了复杂的代理交互，每个 AI 组件都有特定的角色。代理通过通信和协调来完成完整的国际象棋对弈体验，展示了多个专业 AI 如何有效地协同工作。

### 代码

完整代码可在 [Agno 仓库](https://github.com/agno-agi/agno/tree/main/cookbook/examples/streamlit_apps/chess_team) 中找到。

### 使用方法

<Steps>
  <Step title="克隆仓库">
    ```bash theme={null}
    git clone https://github.com/agno-agi/agno.git
    cd agno
    ```
  </Step>

  <Step title="创建虚拟环境">
    ```bash theme={null}
    python3 -m venv .venv
    source .venv/bin/activate  # 在 Windows 上使用：.venv\Scripts\activate
    ```
  </Step>

  <Step title="安装依赖项">
    ```bash theme={null}
    pip install -r cookbook/examples/streamlit_apps/chess_team/requirements.txt
    ```
  </Step>

  <Step title="设置 API 密钥">
    Chess Team Agent 使用 Anthropic API 进行代理推理：

    ```bash theme={null}
    export ANTHROPIC_API_KEY=your_api_key_here
    ```
  </Step>

  <Step title="启动应用">
    ```bash theme={null}
    streamlit run cookbook/examples/streamlit_apps/chess_team/app.py
    ```
  </Step>

  <Step title="打开应用">
    然后在浏览器中打开 [http://localhost:8501](http://localhost:8501) 开始观看 AI 代理下国际象棋。
  </Step>
</Steps>

### 专业建议

* 观看完整对局：观察完整的对局以了解代理的决策过程
* 监控代理交互：留意代理如何沟通和协调

需要帮助？加入我们的 [Discourse 社区](https://agno.link/community) 获取支持！
