Skip to content

About

Autonomous coding agent: Gemini plans and writes projects through tool calls, Codestral reviews them. Node.js, Express, SSE UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

Repository files navigation

AI Multi-Code Agent

An autonomous coding agent you drive from the browser. Describe an app ("build a todo app with local storage") and a Gemini 2.0 Flash agent plans it, creates the folders and files through tool calls, and streams every step to the UI. Then a second agent built on Mistral Codestral reviews the generated project and writes a quality report.

Platform note: the code agent issues Windows PowerShell commands on the host machine (New-Item, Out-File) and opens the result in VS Code. Run it on Windows, on a machine you trust.

How it works

Browser UI (frontend/)  ──POST /api/agent──▶  Express server (backend/server/index.js)
        ▲                                         │ spawns
        │  Server-Sent Events (status, code,      ▼
        │  files created, tool calls)       Code agent (backend/agent/index.js)
        │                                    Gemini 2.0 Flash, JSON-mode output
        │                                    loop: START → THINK → ACTION → OBSERVE → OUTPUT
        │                                    tool: executeCommand (PowerShell)
        │
        └──── "Test Application" ──▶ Test agent (backend/agents/test_agent.js)
                                      Mistral Codestral reviews every source file
                                      → TEST_ANALYSIS_REPORT.md in the project folder
  • Structured agent loop. The model must answer in JSON (step: think | action | observe | output). Each action is dispatched to a tool and the result is fed back as an observe step.
  • Live streaming. Agent status, the code being written, and every file and folder it creates are pushed to the browser over SSE (/api/agent/status/stream, /api/test-agent/status/stream).
  • Review agent. Codestral reads the generated files and reports on functionality, security, performance and code quality, with suggested test cases. It reviews the code; it does not execute a test suite.
  • Auth. Email/password (bcrypt) and Google sign-in (Firebase), with Express sessions. Users are stored in PostgreSQL (USE_DATABASE=true) or a local JSON file.

Tech stack

Node.js (ES modules) · Express · @google/generative-ai · Mistral API · Server-Sent Events · PostgreSQL (pg, connect-pg-simple) · Firebase Admin · bcryptjs · vanilla HTML/CSS/JS frontend

Getting started

Requirements: Node.js 18+, Windows with PowerShell, VS Code on PATH (optional, for auto-open), a Gemini API key and a Mistral API key.

git clone https://github.com/suhailult777/AI-multi-code-agent.git
cd AI-multi-code-agent
npm install

Create a .env in the project root:

PORT=3000
SESSION_SECRET=change-me
GEMINI_API_KEY=your-gemini-key        # code agent
MISTRAL_API_KEY=your-mistral-key      # review agent
USE_DATABASE=false                    # true + DATABASE_URL to use PostgreSQL
# DATABASE_URL=postgresql://user:password@host/db
# FIREBASE_PROJECT_ID / FIREBASE_CLIENT_EMAIL / FIREBASE_PRIVATE_KEY  (only for Google sign-in)

Run it:

npm run dev          # http://localhost:3000
npm run migrate      # optional: move JSON users into PostgreSQL
npm test             # agent, integration and SSE flow scripts

Project layout

backend/
  agent/index.js        Gemini code agent + tool loop
  agents/test_agent.js  Codestral review agent
  server/               Express app, auth, storage (JSON / Postgres)
  api/                  serverless variants of the same endpoints
  scripts/              JSON → Postgres migration
frontend/               single-page UI (agent mode, live code view, theme toggle)
test/                   Node test scripts and SSE test pages

Limitations

  • Windows-only command layer; the agent runs whatever PowerShell the model asks for, so treat it as a local dev tool, not a hosted service.
  • One tool (executeCommand) does all file work, so file paths are parsed out of the command text for the live UI.

License

MIT

About

Autonomous coding agent: Gemini plans and writes projects through tool calls, Codestral reviews them. Node.js, Express, SSE UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages