Skip to content

Latest commit

 

History

History
85 lines (66 loc) · 4.22 KB

File metadata and controls

85 lines (66 loc) · 4.22 KB

Architecture · Forenly AI Skill Agent

This document outlines the system architecture and data flows for the Forenly AI Skill Agent, our entry for the Slack Agent Builder Challenge.


Technical System Architecture

flowchart TD
    subgraph "Humanoid Training Sandbox (Local or Cloud)"
        Sim["MuJoCo Physics Engine<br>(Unitree G1 Simulation)"]
        Daemon["Simulation Monitor Daemon<br>(Detects Anomaly / Collision)"]
        RL_Loop["PyTorch RL Loop / Training Run<br>(Actor-Critic / LoRA Adaptors)"]
        
        Sim <-->|Observation / Joint Actions| RL_Loop
        RL_Loop <-->|Telemetry Metrics| Daemon
    end

    subgraph "Forenly Skill Layer Backend"
        MCP["Model Context Protocol (MCP) Server<br>(Exposes skill registry & metrics)"]
        SlackBackend["Slack App Backend<br>(Node.js/Python Express Listener)"]
        
        Daemon -->|Post Anomaly Event| SlackBackend
        MCP <-->|Expose MCP Tools| SlackBackend
        RL_Loop <-->|Register Model Checkpoints| MCP
    end

    subgraph "Slack Workspace"
        SlackApp["Forenly AI Skill Agent<br>(Slack Client)"]
        Channel["#slack-agent Channel"]
        SlackAI["Slack AI<br>(Conversational Queries)"]
        RTS["Slack RTS API<br>(Inline Logs Search)"]
        
        SlackBackend <-->|API / Webhooks / Block Kit| SlackApp
        SlackApp <-->|Interactive Selection| Channel
        SlackApp <-->|Search Logs| RTS
        SlackApp <-->|Query Metrics| SlackAI
    end

    subgraph "Human-In-The-Loop (HITL)"
        Operator["AI Researcher / Robot Operator"]
        
        Channel -->|Renders 5s Video & Rating Buttons| Operator
        Operator -->|Click Rate Star (1-5) / Apply LoRA| Channel
    end

    style Sim fill:#f9f,stroke:#333,stroke-width:2px
    style RL_Loop fill:#bbf,stroke:#333,stroke-width:2px
    style MCP fill:#bfb,stroke:#333,stroke-width:2px
    style SlackBackend fill:#bfb,stroke:#333,stroke-width:2px
    style SlackApp fill:#fbd,stroke:#333,stroke-width:2px
    style Operator fill:#fdf,stroke:#333,stroke-width:2px
Loading

Core Closed-Loop Training Flow

The Forenly AI Skill Agent connects raw humanoid physical simulation directly to human ML experts inside Slack:

  1. Simulation Anomaly or Run Completion:
    • As the Unitree G1 robot trains walking/grasping in MuJoCo, the Simulation Monitor Daemon continuously checks reward gradients and joint forces.
    • If an anomaly is detected (e.g., joint over-torque, reward collapse) or a training episode finishes, the simulation pauses.
  2. Telemetry Packet Transmission:
    • The daemon sends a JSON payload containing joint coordinates, reward history, and a link to a rendered 5-second video clip to the Slack App Backend.
  3. Block Kit Card Rendering:
    • The Slack backend processes the event and formats a rich interactive card posted to the #slack-agent channel.
    • This card features the video clip, a summary of training metrics, and interactive buttons: [Reset Checkpoint], [Inject Manual Reward], [Apply Grasp-v2 LoRA], and [Override Safety Policy].
  4. Human Interaction & RLHF Scoring:
    • A researcher inspects the clip in Slack, clicks on a 1-to-5 star rating to express preference (RLHF), or selects a corrective LoRA adaptor.
  5. Execution of Corrective Action:
    • The interactive selection fires a webhook back to the Slack App Backend, which makes a secure call to the MCP Server.
    • The MCP server instructs the PyTorch RL Loop to:
      • Update the neural model's reward function based on the star rating.
      • Deploy the chosen LoRA adapter weights.
      • Unpause and resume the MuJoCo simulation with the updated parameters.

Slack Features Implemented

  • Model Context Protocol (MCP) Integration: Exposes ML endpoints like list_active_skills, deploy_skill_adapter(sim_id, skill_id), and get_skill_performance(skill_id) directly to Slack AI.
  • Slack AI Capabilities: Allows natural-language querying of current training runs, checkpoints, and success rates (e.g., "Summarize G1_0's grasping success rate over the last hour").
  • Real-Time Search (RTS) API: Permits instant search and indexing of historical simulation run logs and error messages directly from the channel interface.