Inspiration

Most "multi-agent" systems are just pipelines: one agent hands off to the next, nobody argues, nobody catches mistakes. I wanted to build something where agents genuinely disagree — where a Reviewer can reject the Coder's work, send structured feedback, and refuse to let bad code ship.

What It Does

APEX Society takes a single prompt ("build a REST API with JWT auth") and runs it through 7 specialized Qwen 3.7 agents. The Reviewer agent scores the generated code 0–100. If it scores below 80 or contains any critical security issue, it sends a structured rejection to the Coder with specific fix instructions. The Coder revises only the flagged files and resubmits. The Reviewer re-reviews. Up to 3 rounds, then SelfHealer handles anything remaining.

Real example from a live run:

Reviewer: "REJECTED (score 68/100). CRITICAL: hardcoded JWT secret fallback; missing input validation on /api/auth" Coder: "Revision complete. Patched auth.py, config.py. Resubmitting." Reviewer: "APPROVED after 2 rounds. Score 96/100."

This entire exchange is visible in real time on the dashboard — with animated pixel ghost characters, a live agent dialogue panel, and quality score updating after each round.

How I Built It

7 specialized agents, each with a focused system prompt:

Planner — outputs structured JSON (tech stack, files, API routes, DB schema) Architect — actionable security decisions (middleware order, JWT validation, env var names) Coder — production code with explicit security rules pre-loaded Reviewer — scores from 100, deducts only for real violations, outputs structured rejection notes SelfHealer — auto-patches CVEs and vulnerabilities Debugger — runtime error detection and fix DocWriter — professional README generation

Conflict resolution loop in core/orchestrator.py — up to 3 Reviewer↔Coder cycles with real dialogue events broadcast over WebSocket to the dashboard.

Live dashboard — SVG force-directed graph with Octogent-style pixel art animated characters. Nodes pulse red when Reviewer rejects. Agent Dialogue panel shows every inter-agent message. Quality score updates live.

Qwen 3.7 Max as primary model (1M context, agent-tuned), qwen3.7-plus for vision/multimodal tasks. Full cascade fallback to qwen-plus/qwen-turbo/Groq with automatic retry on rate limits.

MCP server exposing all agent tools as callable endpoints.

Deployed on Alibaba Cloud ECS, Singapore (ap-southeast-1). All inference through Alibaba Cloud DashScope.

Challenges

The hardest part was making _parse_files() reliably extract code from Qwen 3.7's output. Unlike older Qwen models, Qwen 3.7 puts the filename as a comment inside the code block (// src/index.ts) rather than on the fence line. The original regex returned 0 files on every run — a silent failure that caused the Reviewer to score empty code as 100/100. Fixed with a 4-pattern cascading parser that handles every format variant.

The second challenge: the conflict resolution loop needs to hold the "rejected" visual state for at least 2 seconds on the dashboard, or it flashes red and immediately goes back to yellow before judges can see it. Fixed with a JavaScript lock that delays the state transition.

Accomplishments

Benchmark: 0 CVEs shipped vs 1 critical CVE from single agent (hardcoded JWT secret) 17–22 files generated per run vs 5 for single agent Real reject/revise/approve loop with structured inter-agent dialogue Full MCP integration — agents callable as external tools 35 tests passing, clean syntax, production deployed

What I Learned

LLMs respond to concrete examples far better than abstract rules. "Never hardcode secrets" gets ignored. "BAD: os.getenv('KEY', 'fallback') — GOOD: os.getenv('KEY')" with no default gets followed. The Reviewer's prompt went from "be strict" to "start at 100, deduct 25 for hardcoded secret with value" and quality jumped immediately.

What's Next

Multimodal: upload a wireframe screenshot → agents generate the frontend code (qwen3.7-plus is already wired in) Memory across sessions: agents remember past projects and reuse good patterns Parallel agent execution: Architect and Planner running simultaneously

Built With

qwen-cloud, qwen3.7-max, alibaba-cloud, dashscope, fastapi, websockets, python, svg, javascript

Built With

Share this project:

Updates