An AI-powered PowerShell assistant that converts natural language into PowerShell commands using Gemini and LangChain.
Project description
๐ค AI Shell Agent
An AI-powered command-line assistant that converts natural language into Windows PowerShell commands using Google Gemini and LangChain. Before executing any command, the agent validates it and asks for user confirmation to ensure safe execution.
โจ Features
- ๐ค Natural language to PowerShell command generation
- ๐ง Powered by Google Gemini using LangChain
- ๐ก๏ธ Command validation before execution
- โ User confirmation before running commands
- โก Automatic PowerShell command execution
- ๐ป Interactive command-line interface
- ๐ช Designed for Windows PowerShell
๐๏ธ Project Architecture
User Input
โ
โผ
AI Shell Agent
โ
โผ
LangChain + Gemini
โ
โผ
PowerShell Command
โ
โผ
Command Validator
โ
โผ
User Confirmation
โ
โผ
Command Executor
โ
โผ
Windows PowerShell
๐ Project Structure
ai-shell-agent/
โ
โโโ app/
โ โโโ __init__.py
โ โโโ main.py
โ โโโ agent.py
โ โโโ llm.py
โ โโโ validator.py
โ โโโ executor.py
โ โโโ prompts.py
โ
โโโ README.md
โโโ LICENSE
โโโ pyproject.toml
โโโ .env.example
โโโ .gitignore
โ๏ธ Tech Stack
- Python 3.11+
- LangChain
- Google Gemini API
- python-dotenv
- subprocess (Python Standard Library)
- PowerShell
๐ Installation
Clone the repository:
git clone https://github.com/Nishtha-06/ai-shell-agent
cd ai-shell-agent
Install dependencies using uv:
uv sync
or using pip:
pip install -e .
๐ Environment Variables
Create a .env file in the project root.
GEMINI_API_KEY=your_gemini_api_key
You can get an API key from:
https://aistudio.google.com/app/apikey
โถ๏ธ Running the Agent
Run the application:
ai-shell
or
python -m app.main
๐ฌ Example
You > Create a folder named Project
Generated Command:
mkdir Project
Execute this command? (y/n): y
Command executed successfully.
๐ Workflow
Natural Language
โ
โผ
Gemini (LangChain)
โ
โผ
PowerShell Command
โ
โผ
Validator
โ
โผ
Confirmation
โ
โผ
Executor
โ
โผ
PowerShell
๐ก๏ธ Safety
Before executing any generated command, the agent:
- Validates the generated PowerShell command
- Blocks potentially unsafe commands (based on validator rules)
- Requests user confirmation before execution
This helps prevent accidental execution of harmful commands.
๐ Current Limitations
- Supports Windows PowerShell only
- Requires a Google Gemini API key
- Executes one command at a time
- Does not maintain conversation memory between commands
๐ Future Improvements
- Conversation memory
- LangGraph integration
- Tool calling
- Command history
- Plugin support
- Persistent shell session
- Linux and macOS support
- Rich terminal interface
๐ฉโ๐ป Author
Nishtha Modi
๐ License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nishtha_ai_shell_agent-1.0.0.tar.gz.
File metadata
- Download URL: nishtha_ai_shell_agent-1.0.0.tar.gz
- Upload date:
- Size: 92.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
031bb93107bd9bb563bf6d900b42029faba3616d59f580ffb8a70ff5a46a5d58
|
|
| MD5 |
5663d721f95f44b93993e992a10c887c
|
|
| BLAKE2b-256 |
53ee73ca1c340e972443167d70f866b768f5a6b1753baff02f1876ef05fbf107
|
File details
Details for the file nishtha_ai_shell_agent-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nishtha_ai_shell_agent-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d682ee53bd25855e95ff029166a0542d0eb310e6e68bdcc462096f875447499d
|
|
| MD5 |
372ecf2eae207f8ecdb10fef0b7f3386
|
|
| BLAKE2b-256 |
b9548a19b7ad111437de57e16a7c1d9f418cb4bc7b729e405670eddad2aec38f
|