Skip to content

A powerful AI coding assistant built with Gemini 2.5 Flash and Chainlit, capable of writing, reading, and organizing code directly through conversation.

Notifications You must be signed in to change notification settings

hassannawaz02/ai-coding-agent

Repository files navigation

🤖 My AI Coding Assistant — Powered by Gemini & Chainlit

Inspired by Cursor AI and built with the power of Google Gemini 2.5 Flash, this AI Coding Agent can understand your natural language commands and turn them into working code files, folders, and structured projects — all through a simple chat interface.


🚀 Features

  • AI Code Writing:
    Converts natural language instructions into real code files using Gemini AI.

  • Project Planning:
    Automatically creates folders and organizes files before writing code.

  • File Operations:
    Supports creating, reading, and listing files and folders.

  • Interactive Chat Interface:
    Integrated with Chainlit, allowing real-time conversations directly in your browser.

  • Error Handling & Memory:
    Remembers the last few messages to keep the context, and handles runtime errors gracefully.


🧠 How It Works

The agent is powered by:

  • Google Gemini 2.5 Flash for reasoning and code generation
  • Python for backend logic and file operations
  • Chainlit for an interactive web-based chat UI

When you chat with it, the model processes your message and responds in a structured JSON format containing:

{
  "thought": "AI reasoning steps",
  "action": "create_file / read_file / create_folder / list_files / none",
  "name": "file_or_folder_name",
  "content": "optional_file_content",
  "reply": "message_to_user"
}

Then, based on that action, the app performs the requested task locally and returns the result instantly.


💻 Example Commands

You can say things like:

create a folder named "project_demo"
create a python file named "main.py" with a hello world program
read the file main.py
list files in project_demo
create a folder named "utils" and add a file "helper.py" with a simple function

⚙️ Installation & Setup

  1. Clone this repository

    git clone https://github.com/hassannawaz02/ai-coding-agent.git
    cd ai-coding-agent
  2. Install dependencies

    pip install chainlit google-generativeai
  3. Set your Gemini API key

    export GEMINI_API_KEY="your_api_key_here"
  4. Run the app

    chainlit run app.py -w

📁 Project Structure

ai-coding-agent/
│
├── app.py              # Main Chainlit + Gemini agent logic
├── requirements.txt     # Dependencies list
└── README.md            # Project documentation

🧩 Tech Stack

  • Python 3.10+
  • Chainlit — Chat-based interface
  • Google Gemini 2.5 Flash — LLM for reasoning and code generation

🙏 Acknowledgment

Special thanks to Subhan Kaladi for the inspiration that sparked this idea.
This is an early version — I plan to improve it step by step to make it more powerful, autonomous, and developer-friendly.


👨‍💻 Created by Hassan Nawaz

“Code smarter, not harder — let AI handle the heavy lifting.”

About

A powerful AI coding assistant built with Gemini 2.5 Flash and Chainlit, capable of writing, reading, and organizing code directly through conversation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages