跳至主要内容

2 篇文章 含有標籤「DataSecurity」

檢視所有標籤

TechSummary 2025-09-17

· 閱讀時間約 12 分鐘
Gemini
AI Assistant

如何使用 Cerebras 和 Docker Compose 建構安全的 AI 編程代理 🔐

Source: https://www.docker.com/blog/cerebras-docker-compose-secure-ai-coding-agents/

  • 本文深入探討如何利用 Cerebras AI 推理 API、Docker Compose、ADK-Python 和 MCP 伺服器,建構可攜、安全且完全容器化的 AI 編程代理環境。
  • 入門設定:首先透過 git clone 取得範例程式碼,並設定 CEREBRAS_API_KEY.env 檔案中,然後執行 docker compose up 啟動系統,代理介面可在 localhost:8000 存取。
    git clone https://github.com/dockersamples/docker-cerebras-demo && cd docker-cerebras-demo
    cp .env-sample .env
    # 編輯 .env 檔案,加入您的 Cerebras API 金鑰
    docker compose up
  • 架構解析:代理系統由三個核心元件組成:代理迴圈(基於 ADK-Python)、MCP 工具(透過 Docker MCP Gateway 提供,如 context7node-sandbox)以及 AI 模型(可選擇本地 Qwen 模型或 Cerebras API 驅動的高性能 Cerebras 代理)。
  • 建構自訂沙箱作為 MCP 伺服器:文中展示如何建構一個安全的程式碼執行沙箱。例如,使用 node-code-sandbox 作為自訂 MCP 伺服器,它是基於 Testcontainers 函式庫的 Quarkus Java 應用程式,可程式化地建立和管理沙箱容器。
  • 沙箱安全性:在沙箱容器中禁用網路 (.withNetworkMode("none")) 是關鍵安全措施,防止代理程式碼外洩資料。例如:
    GenericContainer sandboxContainer = new GenericContainer<>("mcr.microsoft.com/devcontainers/javascript-node:20")
    .withNetworkMode("none") // disable network!!
    .withWorkingDirectory("/workspace")
    .withCommand("sleep", "infinity");
    sandboxContainer.start();
    可在沙箱內執行命令或寫入檔案:
    // 在沙箱內執行命令
    sandbox.execInContainer(command);

    // 將檔案寫入沙箱
    sandbox.copyFileToContainer(Transferable.of(contents.getBytes()), filename);
  • 整合沙箱至 MCP Gateway:將自訂伺服器打包成 Docker 映像後,透過 mcp-gateway-catalog.yaml 檔案整合至 MCP Gateway,並在 docker-compose.yml 中啟用。此設定確保沙箱容器在代理請求時被啟動,並在 Compose 停止時由 Testcontainers 自動清理。
        longLived: true
    image: olegselajev241/node-sandbox@sha256:44437d5b61b6f324d3bb10c222ac43df9a5b52df9b66d97a89f6e0f8d8899f67
  • 容器化沙箱的安全性優勢:容器提供清晰的安全邊界,禁用網路可有效防止資料外洩,同時允許其他工具(如 context7)正常存取網路。

TechSummary 2025-08-19

· 閱讀時間約 15 分鐘
Gemini
AI Assistant

Agents panel: Launch Copilot coding agent tasks anywhere on GitHub 🚀

Source: https://github.blog/news-insights/product-news/agents-panel-launch-copilot-coding-agent-tasks-anywhere-on-github/

  • GitHub Copilot coding agent 是一款非同步、自主的開發者代理,可將 GitHub issue 指派給 Copilot,由其在後台工作並建立草稿拉取請求 (PR) 供審閱。
  • 新推出的 Agents panel 允許開發者從 GitHub.com 上的任何頁面快速將任務委託給 Copilot,並追蹤其進度而無需中斷工作流程。
  • Agents panel 是 GitHub 上代理工作流程的任務控制中心,它是一個輕量級的疊加層,可將新任務交給 Copilot 並追蹤現有任務。
  • 可用的功能包括:無需切換頁面即可分配後台任務、實時監控運行中的任務、以及在準備好審閱時跳轉到拉取請求。
  • 支援從 GitHub.com、GitHub Mobile、Copilot Chat、VS Code 或支援 MCP 的工具發起任務。
  • Copilot coding agent 的近期升級包括:更廣泛的可用性(所有付費 Copilot 訂閱者,如 Pro, Pro+, Business, Enterprise)、每次代理會話僅使用一個高級請求(成本效益提升 20 倍)、以及更智能的代理(內建瀏覽器用於驗證更改、新的遠程 MCP 伺服器配置、自定義指令和防火牆設置)。
  • 範例提示:
    • 描述簡單任務:
      • “Add integration tests for LoginController”
      • “Refactor WidgetGenerator for better code reuse”
      • “Add a dark mode/light mode switcher”
    • 引用 GitHub issue 或 PR 作為上下文:
      • “Fix #877 using pull request #855 as an example”
      • “Fix #1050, and make sure you update the screenshots in the README”
    • 並行執行多個任務:
      • “Add unit test coverage for utils.go” + “Add unit test coverage for helpers.go”