A CLI coding agent built in Python using Google's GenAI SDK (google-genai). Give it a working directory and tell it what you want to do. It can explore your project, read and edit code, create or delete files and folders, and run Python scripts.
The agent uses five tools:
- get_file_info: Explore files and folders.
- get_file_content: Read file contents.
- write_file: Create new files or edit existing ones.
- run_python_file: Run Python files and check their output.
- delete_path: Delete files or directories.
- Python 3.12+
- Google Gemini API key
- uv
1. Install uv
On Linux or macOS:
curl -LsSf https://astral.sh/uv/install.sh | shCheck the installation:
uv --version2. Clone the project
git clone https://github.com/adityassarode/cli-coding-agent.git
cd cli-coding-agent3. Install dependencies
uv syncThis creates a virtual environment and installs the dependencies listed in pyproject.toml and uv.lock.
4. Set up your API key
Create a .env file in the project directory:
GEMINI_API_KEY=your_gemini_api_keyGet your API key from Google AI Studio.
Open config.py and set the directory where you want the agent to work.
I've included a calculator folder so you can test the agent without creating your own project.
Install the project locally:
uv pip install -e .Now you can run the agent directly:
cli-coding-agent "Explore the project and explain its structure"You can use the same command for other tasks:
cli-coding-agent "Find bugs in the calculator project and fix them"
cli-coding-agent "Read calculator.py and explain how it works"
cli-coding-agent "Create a Python file that calculates factorial"
cli-coding-agent "Run main.py and tell me its output"
cli-coding-agent "Delete the test.txt file"
cli-coding-agent "Delete the old_directory folder"You no longer need to write uv run or main.py every time.
You can also run the agent without installing the CLI command separately:
uv run main.py "Explore the project and explain its structure"Or use the registered project command through uv:
uv run cli-coding-agent "Explore the project and explain its structure"The agent chooses which tools to use based on your instruction and returns the result.
1. Gemini API key error
Make sure your .env file exists in the project directory and contains a valid API key.
2. Module not found
Install the project dependencies again:
uv sync3. File or directory not found
Check that the path exists inside the working directory configured in config.py.
4. Permission denied
Make sure the requested files or folders are inside the configured working directory and that your operating system allows the agent to read, write, execute or delete them.