Skip to content

praharshithavishnubhatla/Dev-agent

Repository files navigation

πŸ€– Dev Agent - Your Intelligent Development Assistant

Python 3.8+ License: MIT Tests

An intelligent command-line agent that understands natural language and helps you manage files, analyze code, and automate development tasks.

A full-stack AI agent platform with:

β€’ Python-based tool-driven agent
β€’ FastAPI service layer
β€’ Modern Next.js SaaS dashboard
β€’ Session-based conversations
β€’ Multi-chat support
β€’ Glass-style UI
β€’ Developer automation tools

✨ Features

🧠 Agent Core

  • Natural language intent routing
  • Tool registry + argument extraction
  • Conversation memory
  • File system automation
  • Code analysis
  • Git integration
  • Web search & scraping

🌐 Web Dashboard (NEW)

  • ChatGPT-style UI
  • Sidebar conversation history
  • Dark SaaS theme
  • Session persistence
  • FastAPI integration
  • Health checks
  • Multi-conversation support

βš™οΈ API Layer

  • /agent/chat
  • /agent/reset
  • /agent/health
  • CORS enabled
  • Session management

πŸ“ File System Operations

  • Create, delete, rename files and folders
  • Open files and folders with default applications
  • Preview file contents
  • Smart path resolution (Desktop, Downloads, Documents shortcuts)

πŸ” Intelligent Search

  • Search files by name, extension, or content
  • Find recently modified files
  • Multi-root search across common directories

πŸ’» Code Analysis

  • Dead code detection in Python files
  • LLM-powered code explanations (via Groq API)
  • Intent-based code search
  • Function-level analysis

πŸ”§ Development Tools

  • Create virtual environments
  • Install Python packages
  • Git status and commit history
  • Project-aware operations

🌐 Web Integration

  • Web search (DuckDuckGo)
  • Fetch URL contents
  • Integration-ready architecture

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/praharshithavishnubhatla/dev-agent.git
cd dev-agent

# Install dependencies
pip install -r requirements.txt

# (Optional) Set up Groq API for LLM features
export GROQ_API_KEY="your_api_key_here"

Usage

# Run the agent
python agent.py

Example Commands

🧠 You: create a file called notes.txt on desktop
πŸ€– Agent: βœ… File created at `/Users/you/Desktop/notes.txt`

🧠 You: find dead code in my project
πŸ€– Agent: 🧠 Dead code report:
         {'/path/to/file.py': ['unused_function', 'old_helper']}

🧠 You: explain main.py
πŸ€– Agent: 🧠 LLM Code Summary β€” main.py
         This script implements a command-line interface...

🧠 You: search files containing "TODO"
πŸ€– Agent: Found 5 files: [...list of files...]

🧠 You: install requests fastapi in myproject
πŸ€– Agent: πŸ“¦ Installing packages: requests, fastapi

πŸ“– Documentation

Intent Classification

The agent understands natural language commands and classifies them into intents:

Command Intent What it does
"create test.py" create_file Creates a new file
"open main.py" open_file Opens file with default app
"find dead code" dead_code_detector Analyzes project for dead code
"explain app.py" llm_summarize_code AI explanation of code
"search for TODO" search_files_by_content Searches file contents
"git status" git_status Shows git status
"create venv in project" create_virtualenv Creates virtual environment

Supported Intents

File Operations:

  • create_file, create_folder
  • open_file, open_folder
  • delete_path, rename_file
  • preview_file

Code Analysis:

  • dead_code_detector, dead_code_in_file
  • llm_summarize_code
  • code_intent_search

Search:

  • search_files_by_name
  • search_files_by_extension
  • search_files_by_content
  • list_recent_files

Development:

  • create_virtualenv
  • install_packages
  • git_status, git_last_commits

Web:

  • open_web_search, fetch_url

Architecture

dev-agent/
β”œβ”€β”€ agent.py                 # Main entry point
β”œβ”€β”€ tools/                   # Tool implementations
β”‚   β”œβ”€β”€ fs.py               # File system operations
β”‚   β”œβ”€β”€ search.py           # File search utilities
β”‚   β”œβ”€β”€ code_analysis.py    # Code analysis tools
β”‚   β”œβ”€β”€ git.py              # Git operations
β”‚   β”œβ”€β”€ execution.py        # Virtual env & packages
β”‚   └── web.py              # Web utilities
β”œβ”€β”€ routing/                # Intent routing & extraction
β”‚   β”œβ”€β”€ intent_classifier.py
β”‚   β”œβ”€β”€ argument_extractor.py
β”‚   └── tool_registry.py
β”œβ”€β”€ core/                   # Core agent logic
β”‚   β”œβ”€β”€ interactive_executor.py
β”‚   β”œβ”€β”€ conversation_state.py
β”‚   └── memory.py
└── tests/                  # Test suite

πŸ§ͺ Testing

Run the comprehensive test suite:

python tests/test_agent.py

Current test coverage: 100% passing (39/39 tests)

πŸ”§ Configuration

Groq API Setup (for LLM features)

  1. Get a free API key from Groq
  2. Set the environment variable:
    export GROQ_API_KEY="your_api_key_here"
  3. The agent will automatically use it for code explanations

Search Roots Configuration

Edit SEARCH_ROOTS in core/interactive_executor.py to customize where the agent searches:

SEARCH_ROOTS = [
    "~/Downloads",
    "~/Documents",
    "~/your-projects-folder"
]

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

# Clone and install in development mode
git clone https://github.com/praharshithavishnubhatla/dev-agent.git
cd dev-agent
pip install -e .

# Run tests
python tests/test_agent.py

Adding New Tools

  1. Create tool function in appropriate file under tools/
  2. Register in routing/tool_registry.py
  3. Add schema in routing/tool_schema.py
  4. Add questions in routing/tool_questions.py
  5. Update intent classifier if needed
  6. Add tests

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with Python
  • LLM integration via Groq
  • Inspired by modern AI assistants and agentic workflows

πŸ“ž Contact

Have questions or suggestions? Open an issue or reach out!


Note: This is a personal development tool. Always review commands before execution, especially destructive operations like delete.

🎯 Roadmap

  • Support for more LLM providers (OpenAI, Anthropic, local models)
  • Interactive mode improvements (autocomplete, history)
  • More code analysis features (complexity metrics, linting)
  • Docker container support
  • Web UI interface
  • Plugin system for custom tools
  • Multi-language support (beyond Python)
  • Automated testing suggestions
  • Code refactoring recommendations

πŸ› Known Issues

None currently! If you find a bug, please open an issue.

About

An intelligent command-line agent that understands natural language and automates development tasks. Features: file operations, code analysis with LLM, search, git integration, and FastAPI service layer.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors