Skip to content

Ramakant99/local-Ai-Agent

Repository files navigation

Local-First AI Coding Assistant (AutoGen Crew)

A production-grade, local-first multi-agent AI coding assistant built on the Microsoft AutoGen framework. It leverages a local llama.cpp server (or equivalent OpenAI-compatible local endpoints) to run an autonomous crew of specialized agents that collaborate to plan, write, audit, test, and document code within your workspace.


🏗️ Architecture & Component Roster

The project is structured into three main layers:

├── backend/            # FastAPI Backend & Orchestrator
├── cli/                # Interactive Typer Command-line interface
├── frontend/           # Svelte/Vite/Tailwind Desktop UI
└── run_assistant.py    # Main system runner entry point

1. The Multi-Agent Orchestrator (backend/orchestrator.py)

Utilizes a Supervisor/Coordinator design pattern to orchestrate conversational turns in an AutoGen GroupChat across specialized roles:

  • UserProxy: Represents you, manages local command execution, and executes tool calls.
  • Coordinator (Supervisor): Audits progress, verifies outputs, and delegates milestones.
  • Planner: Creates step-by-step roadmap documents detailing dependencies.
  • Coder: Writes robust, modular, and self-documenting code.
  • Reviewer / Tester / Debugger: Quality checks code, writes/runs tests, and acts on stderr tracebacks.
  • Research / MCPAgent: Utilizes web search, semantic indexing, and Model Context Protocol (MCP) servers.

2. The Vector Database & Indexer (backend/indexer.py)

Indexes workspace files chunk-by-chunk using a local vector index. Provides semantic search capabilities using FAISS and embedding similarity calculations to allow agents to find code snippets.

3. Svelte Web UI (frontend/)

Provides a rich dashboard experience:

  • File Explorer & Code Editor: View workspace files recursively and edit them using an integrated Monaco Editor.
  • Interactive Chat Logs: Streams agent thoughts (live thinking process) and messaging turns.
  • Live Tool Running Trace: A console drawer logging tool actions (e.g. read/write files, shell commands).
  • Imports Mapping Graph: Visualizes codebase import relationships.

🛠️ Prerequisites & Setup

1. LLM Server (llama.cpp)

Ensure you have a local llama.cpp server (or LM Studio) running on port 8082 serving a compatible model (e.g. gemma-4-12b-it-Q4_K_M.gguf).

  • Base URL: http://localhost:8082/v1
  • Capabilities needed: The server must support chat completions with streaming enabled.

2. Python Environment

Install dependencies:

pip install -r requirements.txt

3. Frontend Build (Optional, for Web UI server)

Install Node modules and compile the static bundle:

cd frontend
npm install
npm run build

⚙️ Configuration

There are two primary ways to configure and customize your assistant:

1. Environment Variables (.env)

Copy the provided .env.example to .env to configure your AI models:

  • LLM_MODEL: The name of the model you are running (e.g., gemma-4-12b-it-Q4_K_M.gguf)
  • LLM_API_BASE: URL to your local server (e.g., http://localhost:8082/v1)
  • LLM_API_KEY: Your API key (use not-needed for local)
  • EMBEDDING_MODEL / URL / DIM: Configurations for the semantic codebase search.

2. User Interface Labels (labels.json)

You can easily customize all text, tooltips, and labels in the desktop UI without touching any Svelte code!

  • Simply edit frontend/src/labels.json.
  • The Vite server will automatically hot-reload your changes if you are running in development mode, or they will be bundled on your next npm run build.

🚀 How To Run

Use run_assistant.py to launch the assistant in different modes:

1. Run the FastAPI Backend Server

Starts the web backend on port 8000. If the frontend is built, it will serve the Web UI on http://localhost:8000.

Web UI Interface

python run_assistant.py server

2. Run a Single Crew Task (Terminal)

Instructs the crew to execute a task immediately within the terminal:

python run_assistant.py task "Create a file index.html with simple hello world html"

3. Run the Interactive CLI REPL

Starts an interactive terminal session where you can chat with the assistant or run slash commands:

Interactive CLI

python run_assistant.py cli

Interactive CLI Commands:

  • /help - View available commands.
  • /plan <task> - Request the Planner to build a step-by-step roadmap.
  • /search <query> - Run a semantic code search across the workspace.
  • /git <args> - Run git status, diff, or log commands.
  • /review <file> - Audit a workspace file for bugs or improvements.
  • /exit - Quit the session.

About

Your private, autonomous AI development team. Built on AutoGen and designed to run entirely locally via llama.cpp. Features a rich Svelte dashboard with a Monaco code editor, live agent thought streaming, an interactive dependency graph, Model Context Protocol (MCP) support, and terminal sandboxing—all without sending code to the cloud.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors