PMAgent
PMAgent is a Python package that helps developers, data scientists, and DevOps professionals to refactor and modify code using OpenAI/Groq. It reads code from files, interacts with an LLM to generate modifications, and saves changes back to the files. It can create new projects in any programming language with just a prompt.
Installation
pip install PMAgent
Environment Setup
# API Keys (at least one is required)
export OPENAI_API_KEY="sk-..."
export GROQ_API_KEY="gsk_..."
# Optional Configuration
export MODEL="" # Specific model to use
export TEMPERATURE="" # Temperature for response generation
export TOP_P="" # Top-p sampling parameter
export MAX_TOKENS="" # Maximum tokens in response
Basic Usage
pmagent <UserPrompt> <directorytoexecute>
Parameters:
UserPrompt: Your instruction or request in quotesdirectorytoexecute: Path to the target directory (optional)--llm-typeor-l: Choose LLM provider (openaiorgroq) (optional)
Examples
1. Web Development Projects
# Create a new React e-commerce project
pmagent "Create a React e-commerce website with product listing, cart functionality, and checkout process" ecommerce-app
# Build a portfolio website
pmagent "Create a modern portfolio website with dark/light mode, project showcase, and contact form" portfolio-site
# Create a dashboard
pmagent "Build a responsive admin dashboard with charts, tables, and user management" admin-dashboard
2. Data Science & Analysis
# Create data analysis notebook
pmagent "Create a comprehensive EDA notebook for customer churn analysis including visualizations" churn-analysis
# Build ML pipeline
pmagent "Create a machine learning pipeline for house price prediction with data preprocessing and model evaluation" ml-pipeline
# Time series analysis
pmagent "Set up a time series analysis project for stock price prediction with LSTM" stock-analysis
3. Backend Development
# Create API server
pmagent "Create a FastAPI backend with user authentication, database models, and CRUD operations" backend-api
# Setup microservices
pmagent "Set up a microservices architecture with user service and product service using Docker" microservices
# Create CLI tool
pmagent "Create a Python CLI tool for automated file organization with logging" file-organizer
4. DevOps & Infrastructure
# Setup CI/CD pipeline
pmagent "Create GitHub Actions workflow for testing and deploying a Python package" cicd-setup
# Infrastructure as Code
pmagent "Create Terraform configuration for AWS ECS cluster with auto-scaling" terraform-aws
# Docker setup
pmagent "Create Docker configuration for a MERN stack application" docker-config
5. Code Refactoring
# Refactor existing code
pmagent "Refactor the Python code in utils/ to follow SOLID principles" utils
# Add tests
pmagent "Add unit tests for all functions in the services/ directory" services
# Optimize performance
pmagent "Optimize the database queries in the repositories/ folder" repositories
Python API Usage
import os
from pmagent import LLMInteractionManager
def main():
# Initialize with configuration
llm_interaction_manager = LLMInteractionManager(
openai_api_key=os.getenv("OPENAI_API_KEY"),
groq_api_key=os.getenv("GROQ_API_KEY"),
config={ # OPTIONAL
"model": "llama-3.1-70b-versatile",
"temperature": 0.5,
"top_p": 0.9,
"max_tokens": 4000,
},
llm_type='groq', # OPTIONAL
)
# Example: Create a new project
llm_interaction_manager.interact_with_llm(
user_message="Create a FastAPI backend with SQLAlchemy ORM and JWT authentication",
path="backend-project"
)
# Example: Refactor existing code
llm_interaction_manager.interact_with_llm(
user_message="Refactor this code to use dependency injection and add proper error handling",
path="src/services"
)
if __name__ == "__main__":
main()
Best Practices
- Clear Instructions: Be specific in your prompts about what you want to create or modify
- Directory Structure: Create the target directory before running the command if needed
- Version Control: Always commit your changes before using PMAgent for code modifications
- API Keys: Use environment variables for API keys instead of hardcoding them
- Model Selection: Choose the appropriate model based on your task complexity
Support
For issues, feature requests, or contributions, please visit our GitHub repository.
Metadata
Release files for PMAgent 0.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PMAgent-0.2.10.tar.gz | 13.2 kB | Without provenance | Details for PMAgent-0.2.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PMAgent-0.2.10-py3-none-any.whl | Python 3 | none | any | Details for PMAgent-0.2.10-py3-none-any.whl |
Total release size: 27.7 kB
Release files / PMAgent-0.2.10.tar.gz
| Download URL | PMAgent-0.2.10.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a89a71e84e853d2698632010b5735813a551261ff17c935189ad14de1d0e567
|
|
BLAKE2b-256 checksum How to use checksums |
6359e5c7cdbb4441369a2db59390bf839901ebaac0c05d6165406b9a5f065927
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.6
|
Release files / PMAgent-0.2.10-py3-none-any.whl
| Download URL | PMAgent-0.2.10-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b46d2dc1743247737f4e42cc9f98ad0ba413ae99c3a445f07ea05c7a3627af3
|
|
BLAKE2b-256 checksum How to use checksums |
1b6f0f3b569c375fd39dceacb11444b8df6f180887c7ee75c6333c70c3de0e68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.6
|
Security for PMAgent 0.2.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.