SIN-Deploy-Bot
Deploy via automated script [skip ci]
9d4bc2d
|
Raw
History Blame Contribute Delete
5.38 kB
metadata
title: A2A-SIN-Code-backend Agent
sdk: docker
app_port: 7860
pinned: false

A2A-SIN-Code-backend Agent

Status: πŸš€ Production Ready
Version: 1.0.0
Team: Team - Coder
Manager: SIN-Zeus


🎯 Overview

A2A-SIN-Code-backend is an autonomous cloud coder that receives tasks via A2A protocol and executes them using the opencode CLI. It runs on Hugging Face Spaces (CPU-Basic) and works exclusively on the OpenSIN-Code repository.

πŸš€ Features

  • A2A Protocol: Full JSON-RPC 2.0 compliance
  • opencode CLI: Uses Antigravity-powered opencode for all code generation
  • GitHub Integration: Automatic commits to assigned branches
  • Gradio UI: Operator dashboard for manual task submission and monitoring
  • Health Checks: /health endpoint for fleet monitoring
  • Type-Specific: Specialized prompts for backend tasks

πŸ—οΈ Architecture

Request Flow

SIN-Zeus β†’ A2A JSON-RPC β†’ Gradio/FastAPI β†’ opencode CLI β†’ GitHub Commit

Components

  • FastAPI Backend: /a2a/v1 endpoint, health checks, agent-card
  • Gradio Frontend: Manual task submission, status, logs
  • Coder Agent: Task queue, opencode integration, GitHub ops

Environment Variables

Variable Required Description
OPENCODE_API_KEY Yes OpenCode API key
GITHUB_TOKEN Yes GitHub PAT with repo access
HF_TOKEN No Hugging Face token (for deployment)
TELEGRAM_TOKEN No Telegram notifications

πŸ“‘ Interfaces

Interface URL Protocol
Gradio UI Space URL HTTP
A2A API /a2a/v1 JSON-RPC 2.0
Health /health HTTP JSON
Agent Card /.well-known/agent-card.json JSON
Dashboard https://a2a.delqhi.com/agents/sin-code-backend Web

πŸ”§ Usage

Via A2A (Standard)

curl -X POST https://delqhi-a2a-sin-code-backend.hf.space/a2a/v1 \
  -H 'content-type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "message/send",
    "params": {
      "message": {
        "role": "user",
        "parts": [
          {
            "type": "data",
            "data": {
              "description": "Fix the plugin manifest schema validation",
              "type": "plugin",
              "issue_number": 1065
            }
          }
        ]
      }
    }
  }'

Via Gradio UI

  1. Open the Space URL
  2. Fill in task description, select type, enter branch name
  3. Click "πŸš€ Submit Task"
  4. View status and logs

πŸ“Š Sample Task Flow

  1. Receive Task: A2A message with description "Create a new MCP for WhatsApp"
  2. Generate Code: Call opencode run with specialized prompt
  3. Create Files: Agent writes files to repository (through opencode)
  4. Commit: Automatic commit to target branch with issue reference
  5. Report: Status updated in task store, can create PR via separate step

πŸ› οΈ Supported Task Types

Type Description
plugin OpenCode plugins (MCP servers)
command CLI commands (sin-* binaries)
tool Reusable utility functions
backend API, database, business logic
frontend UI components, Next.js, React
fullstack Both frontend + backend

πŸ“ Development

Local Testing

# Prepare environment
export OPENCODE_API_KEY="your-key"
export GITHUB_TOKEN="your-token"
export REPO_DIR="/path/to/OpenSIN-Code"

# Run locally
python app.py

# Access at http://localhost:7860

Building Docker Image

docker build -t delqhi/a2a-sin-code-backend:latest .
docker run -p 7860:7860 -e OPENCODE_API_KEY -e GITHUB_TOKEN delqhi/a2a-sin-code-backend

πŸ” Security

  • API Keys: Use Hugging Face Space secrets, never hardcoded
  • GitHub Token: Scoped to specific repository (OpenSIN-Code)
  • Network: Outbound only to opencode API and GitHub
  • No Persistent Storage: Ephemeral filesystem (HF Space default)

πŸ“ˆ Monitoring

πŸš€ Deployment

To Hugging Face Spaces

# Create Space (CPU-Basic required)
huggingface-cli repo create delqhi-a2a-sin-code-backend --type space --space-sdk docker

# Set secrets
huggingface-cli variable set OPENCODE_API_KEY "$OPENCODE_API_KEY" --repo delqhi-a2a-sin-code-backend --type space
huggingface-cli variable set GITHUB_TOKEN "$GITHUB_TOKEN" --repo delqhi-a2a-sin-code-backend --type space

# Push code
git init
git remote add origin https://huggingface.co/spaces/delqhi/delqhi-a2a-sin-code-backend
git add .
git commit -m "Deploy A2A-SIN-Code-backend v1.0.0"
git push --force origin main

# Set hardware to CPU-Basic (via HF UI or API)

IMPORTANT: Set hardware to cpu-basic in Space settings. Never use GPU/ZeroGPU for coding agents.

πŸ“ž Support


Last Updated: 2026-04-07
Agent: A2A-SIN-Code-backend v1.0.0 Owner: Team - Coder / SIN-Zeus