Skip to content

Repository files navigation

AI Coding Agent

An AI-powered coding assistant that uses Google's Gemini AI to help with various code-related tasks. The agent can analyze code, fix bugs, write new features, and provide technical assistance across different programming projects.

Features

  • AI Coding Assistant: Interact with Gemini AI for general coding tasks:
    • Code analysis and debugging
    • Feature implementation
    • Code refactoring and optimization
    • Technical documentation
    • Test case generation
  • Example Project - Calculator Module: A sample Python calculator demonstrating the agent's capabilities:
    • Basic operations (add, subtract, multiply, divide)
    • Complex expressions with proper operator precedence (e.g., 3*2+5)
    • Safe expression evaluation using Python's AST parser

Project Structure

ai-coding-agent/
├── main.py                 # AI coding agent entry point
├── calculator/
│   ├── main.py            # Calculator CLI application
│   └── pkg/
│       ├── calculator.py  # Calculator implementation
│       └── tests.py       # Unit tests for calculator
├── functions/             # Tool functions for AI agent
└── pyproject.toml        # Project dependencies

Prerequisites

  • Python >= 3.13
  • uv (Python package manager)
  • Google Gemini API key

Installation

  1. Clone the repository:
git clone <repository-url>
cd ai-coding-agent
  1. Install dependencies:
uv sync
  1. Create a .env file with your Gemini API key:
GEMINI_API_KEY=your_api_key_here

Usage

AI Coding Agent

Run the AI coding agent with a prompt:

uv run main.py "Your question or task here"

With verbose output:

uv run main.py "Your question or task here" --verbose

The agent has access to tools that can:

  • List files and directories
  • Read file contents
  • Write files
  • Execute Python files

Calculator

Run the calculator with a mathematical expression:

python calculator/main.py "3*2+5"

Example expressions:

  • "10/2-1" → Result: 4
  • "2+3*4" → Result: 14 (multiplication has higher precedence)
  • "8/2*3" → Result: 12

Running Tests

Navigate to the calculator package directory and run the tests:

cd calculator/pkg
python -m unittest tests.py

Calculator API

The Calculator class provides the following methods:

from calculator.pkg.calculator import Calculator

calc = Calculator()

# Basic operations
calc.add(2, 3)        # Returns 5
calc.subtract(5, 2)   # Returns 3
calc.multiply(3, 4)   # Returns 12
calc.divide(10, 2)    # Returns 5

# Evaluate complex expressions
calc.evaluate("3*2+5")  # Returns 11

Development

This project uses:

  • uv for dependency management
  • Google Gemini AI for AI-powered assistance
  • Python AST for safe expression evaluation

License

MIT License

About

An AI-powered coding assistant that uses Google's Gemini AI to help with various code-related tasks. The agent can analyze code, fix bugs, write new features, and provide technical assistance across different programming projects.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages