healing-agent


Namehealing-agent JSON
Version 0.2.4 PyPI version JSON
download
home_pageNone
SummaryAn AI-powered agent that helps fix and heal buggy code
upload_time2024-11-10 00:32:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords agent ai automation bug-fixing code-healing code-repair debugging developer-tools error-handling exception-handling openai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Healing Agent ๐Ÿฉบ

Healer Agent is an intelligent code assistant that catches with detailed context and fixes errors in your Python code. It leverages the power of AI to provide smart suggestions and corrections, helping you write more robust and "self-healing" code.

โš ๏ธ Not intended for production use. Be extra careful with the optional AUTO_FIX function, as although it makes backups of your code, it actually changes and runs your code. โš ๏ธ

Goal: first actually usable autonomous coding agent in production

## Features โœจ

- ๐Ÿšจ Automatic error detection and handling of diverse exception types
- ๐Ÿ’ก Smart error analysis and solution suggestions (auto-generated fixing hints and code)
- ๐Ÿ” Comprehensive error analysis including exception details, stack traces, local and globalvariables and root cause identification
- ๐Ÿง  Advanced AI-powered code healing using LLMs of different providers
- ๐Ÿ”ง Zero-config integration with Python projects (just import and decorate)
- ๐Ÿ’พ Robust error tracking and debugging:
  - Exception context saved to JSON (code, error details, function info and args)
  - Automatic code backups before fixes
  - Detailed analysis results and fix history
  - Quick test of fixes
- ๐Ÿค– (Optionally) Fully automated operation with minimal human intervention

## How it works ๐Ÿง 

```mermaid
graph TD
    A[Import healing_agent] --> B[Configuration: AI access etc.]
    B --> C[Decorate functions with healing_agent]
    C --> D[Run Code / Execute Functions]
    D -->|No problem| L[Success]
    D -->|Exception?| F[Get and Save Detailed Context]
    F --> G[Auto-generate Fixing Hints and Code with AI]
    G --> H[Test Generated Code]
    H --> I[Create backup]
    I --> J[Apply Code Fixes]
    J --> D
```

## Installation ๐Ÿ’ป

To install Healing Agent, follow these steps:

PIP package from GitHub:

```bash
pip install git+https://github.com/matebenyovszky/healing-agent
```

OR from source:

1. Clone the repository:
   ```bash
   git clone https://github.com/matebenyovszky/healing-agent.git
   ```

2. Navigate to the project directory:
   ```bash
   cd healing-agent
   ```

3. Install:
   ```bash
   pip install -e .
   ```
   OR run overall test to install and test functionality:
   ```bash
   python scripts/overall_test.py
   ```

## Usage ๐Ÿ”ง

To use Healing Agent in your project, follow these steps:

1. Import the `healing_agent` decorator in your Python file:
   ```python
   import healing_agent
   ```

2. Decorate the function you want to monitor with `@healing_agent`:
   ```python
   @healing_agent
   def your_function():
       # Your code here
   ```
   You can also pass parameters to the decorator to change the behavior set in the config file:
   ```python
   @healing_agent(AUTO_FIX=False)
   def your_function():
       # Your code here
   ```

3. Run your Python script as usual. Healing Agent will automatically detect, save context and attempt to fix any errors that occur within the decorated function.

Context (and code file backup in case of auto-fix) is saved to a JSON/Python file in the same directory as your script with actual timestamp in the filename.

## Configuration โš™๏ธ

Healing Agent provides extensive configuration options through the `healing_agent_config.py` file, which defines essential settings such as the AI provider and API credentials. The configuration system follows these principles:

1. **Automatic Configuration Loading**: On startup, Healing Agent attempts to load settings from `healing_agent_config.py`
2. **Fallback Mechanism**: If the configuration file is not found, the system falls back to pre-defined default settings
3. **Auto-Configuration**: When no configuration file exists, Healing Agent automatically creates one in the default user directory

### Supported AI Providers

Healing Agent integrates with multiple AI providers - list could be extended:
- OpenAI
- Azure OpenAI
- LiteLLM
- Anthropic
- Ollama

**Note**: While multiple providers are supported, Azure OpenAI has been extensively tested. Support for other providers is under active development (feedback welcome).

## Testing ๐Ÿงช

To test Healing Agent, you can use the `scripts/test_file_generator.py` script to generate test files in the `tests` directory. `overall_test.py` will run all tests and provide a report on the functionality of Healing Agent.

## Use Cases ๐Ÿ’ก

- **Development**: Use Healing Agent during development to catch and fix errors early, and let AI generate fixes for your code. This is what you would do anyways, but now it's automated. ๐Ÿ˜
- **Educational Tool**: Use Healing Agent as a learning tool to understand AI coding capabilities and limitations.

## Cooking open source ๐Ÿณ

Healing Agent is distributed under the MIT License. See `LICENSE` for more information. Feedback and contributions are welcome!
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "healing-agent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "agent, ai, automation, bug-fixing, code-healing, code-repair, debugging, developer-tools, error-handling, exception-handling, openai",
    "author": null,
    "author_email": "M\u00e1t\u00e9 Benyovszky <benyovszky.mate.work@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/e3/17/00a98f752c5667bdd2539e30521d45694e30312208a541ad38bcae2d6e6d/healing_agent-0.2.4.tar.gz",
    "platform": null,
    "description": "# Healing Agent \ud83e\ude7a\n\nHealer Agent is an intelligent code assistant that catches with detailed context and fixes errors in your Python code. It leverages the power of AI to provide smart suggestions and corrections, helping you write more robust and \"self-healing\" code.\n\n\u26a0\ufe0f Not intended for production use. Be extra careful with the optional AUTO_FIX function, as although it makes backups of your code, it actually changes and runs your code. \u26a0\ufe0f\n\nGoal: first actually usable autonomous coding agent in production\n\n## Features \u2728\n\n- \ud83d\udea8 Automatic error detection and handling of diverse exception types\n- \ud83d\udca1 Smart error analysis and solution suggestions (auto-generated fixing hints and code)\n- \ud83d\udd0d Comprehensive error analysis including exception details, stack traces, local and globalvariables and root cause identification\n- \ud83e\udde0 Advanced AI-powered code healing using LLMs of different providers\n- \ud83d\udd27 Zero-config integration with Python projects (just import and decorate)\n- \ud83d\udcbe Robust error tracking and debugging:\n  - Exception context saved to JSON (code, error details, function info and args)\n  - Automatic code backups before fixes\n  - Detailed analysis results and fix history\n  - Quick test of fixes\n- \ud83e\udd16 (Optionally) Fully automated operation with minimal human intervention\n\n## How it works \ud83e\udde0\n\n```mermaid\ngraph TD\n    A[Import healing_agent] --> B[Configuration: AI access etc.]\n    B --> C[Decorate functions with healing_agent]\n    C --> D[Run Code / Execute Functions]\n    D -->|No problem| L[Success]\n    D -->|Exception?| F[Get and Save Detailed Context]\n    F --> G[Auto-generate Fixing Hints and Code with AI]\n    G --> H[Test Generated Code]\n    H --> I[Create backup]\n    I --> J[Apply Code Fixes]\n    J --> D\n```\n\n## Installation \ud83d\udcbb\n\nTo install Healing Agent, follow these steps:\n\nPIP package from GitHub:\n\n```bash\npip install git+https://github.com/matebenyovszky/healing-agent\n```\n\nOR from source:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/matebenyovszky/healing-agent.git\n   ```\n\n2. Navigate to the project directory:\n   ```bash\n   cd healing-agent\n   ```\n\n3. Install:\n   ```bash\n   pip install -e .\n   ```\n   OR run overall test to install and test functionality:\n   ```bash\n   python scripts/overall_test.py\n   ```\n\n## Usage \ud83d\udd27\n\nTo use Healing Agent in your project, follow these steps:\n\n1. Import the `healing_agent` decorator in your Python file:\n   ```python\n   import healing_agent\n   ```\n\n2. Decorate the function you want to monitor with `@healing_agent`:\n   ```python\n   @healing_agent\n   def your_function():\n       # Your code here\n   ```\n   You can also pass parameters to the decorator to change the behavior set in the config file:\n   ```python\n   @healing_agent(AUTO_FIX=False)\n   def your_function():\n       # Your code here\n   ```\n\n3. Run your Python script as usual. Healing Agent will automatically detect, save context and attempt to fix any errors that occur within the decorated function.\n\nContext (and code file backup in case of auto-fix) is saved to a JSON/Python file in the same directory as your script with actual timestamp in the filename.\n\n## Configuration \u2699\ufe0f\n\nHealing Agent provides extensive configuration options through the `healing_agent_config.py` file, which defines essential settings such as the AI provider and API credentials. The configuration system follows these principles:\n\n1. **Automatic Configuration Loading**: On startup, Healing Agent attempts to load settings from `healing_agent_config.py`\n2. **Fallback Mechanism**: If the configuration file is not found, the system falls back to pre-defined default settings\n3. **Auto-Configuration**: When no configuration file exists, Healing Agent automatically creates one in the default user directory\n\n### Supported AI Providers\n\nHealing Agent integrates with multiple AI providers - list could be extended:\n- OpenAI\n- Azure OpenAI\n- LiteLLM\n- Anthropic\n- Ollama\n\n**Note**: While multiple providers are supported, Azure OpenAI has been extensively tested. Support for other providers is under active development (feedback welcome).\n\n## Testing \ud83e\uddea\n\nTo test Healing Agent, you can use the `scripts/test_file_generator.py` script to generate test files in the `tests` directory. `overall_test.py` will run all tests and provide a report on the functionality of Healing Agent.\n\n## Use Cases \ud83d\udca1\n\n- **Development**: Use Healing Agent during development to catch and fix errors early, and let AI generate fixes for your code. This is what you would do anyways, but now it's automated. \ud83d\ude01\n- **Educational Tool**: Use Healing Agent as a learning tool to understand AI coding capabilities and limitations.\n\n## Cooking open source \ud83c\udf73\n\nHealing Agent is distributed under the MIT License. See `LICENSE` for more information. Feedback and contributions are welcome!",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An AI-powered agent that helps fix and heal buggy code",
    "version": "0.2.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/matebenyovszky/healing-agent/issues",
        "Changelog": "https://github.com/matebenyovszky/healing-agent/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/matebenyovszky/healing-agent#readme",
        "Homepage": "https://github.com/matebenyovszky/healing-agent",
        "Repository": "https://github.com/matebenyovszky/healing-agent.git"
    },
    "split_keywords": [
        "agent",
        " ai",
        " automation",
        " bug-fixing",
        " code-healing",
        " code-repair",
        " debugging",
        " developer-tools",
        " error-handling",
        " exception-handling",
        " openai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebd8af6baab17d45490826b265e2dec02dd2bb82570bf233064e32f00e221f01",
                "md5": "766e546516be095a016442f1eed3ee02",
                "sha256": "9186160671eb1b8ce463e077370e9b1259fe32b71a32e6f4ed3a3553a121a8ca"
            },
            "downloads": -1,
            "filename": "healing_agent-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "766e546516be095a016442f1eed3ee02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 23743,
            "upload_time": "2024-11-10T00:32:53",
            "upload_time_iso_8601": "2024-11-10T00:32:53.253028Z",
            "url": "https://files.pythonhosted.org/packages/eb/d8/af6baab17d45490826b265e2dec02dd2bb82570bf233064e32f00e221f01/healing_agent-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e31700a98f752c5667bdd2539e30521d45694e30312208a541ad38bcae2d6e6d",
                "md5": "16ba6046ca778b48c497e0688cb2a55d",
                "sha256": "0e69af51ec8aeea2dd096869213c3a4e6d3dadc78e9411a8baaa049b2c610947"
            },
            "downloads": -1,
            "filename": "healing_agent-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "16ba6046ca778b48c497e0688cb2a55d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 30374,
            "upload_time": "2024-11-10T00:32:55",
            "upload_time_iso_8601": "2024-11-10T00:32:55.160107Z",
            "url": "https://files.pythonhosted.org/packages/e3/17/00a98f752c5667bdd2539e30521d45694e30312208a541ad38bcae2d6e6d/healing_agent-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-10 00:32:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matebenyovszky",
    "github_project": "healing-agent",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "healing-agent"
}
        
Elapsed time: 0.42387s