responseiq 2.4.0
AI-Powered Infrastructure Copilot: The Self-Healing SRE.
Requires Python: >=3.11
Keywords: ai-ops, devops, infrastructure-as-code, kubernetes, observability, platform-engineering, responseiq, self-healing, sre

# ResponseIQ

[![CI](https://github.com/infoyouth/responseiq/actions/workflows/ci.yml/badge.svg)](https://github.com/infoyouth/responseiq/actions)
[![GitHub Release](https://img.shields.io/github/v/release/infoyouth/responseiq)](https://github.com/infoyouth/responseiq/releases)
[![PyPI](https://img.shields.io/pypi/v/responseiq)](https://pypi.org/project/responseiq/)
[![License](https://img.shields.io/github/license/infoyouth/responseiq)](LICENSE)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

> **"Don't just debug. Fix."**

**ResponseIQ** is an AI-Native **Self-Healing Infrastructure Copilot**.
Unlike traditional parsers that match regex strings, ResponseIQ reads your application logs, **loads your actual source code into an LLM context**, and generates surgical, context-aware remediation patches for incidents.

---

## 📸 See It In Action

![ResponseIQ CLI Demo](docs/assets/demo_placeholder.gif)

*Above: ResponseIQ scanning a crash log, reading the `service.py` file mentioned in the stack trace, and proposing a specific code patch.*

---

## ✨ Key Features

- **🧠 AI-Native Analysis**: Uses Generic AI reasoning instead of fragile regex parsing rules.
- **👁️ Context-Aware**: Reads the local source files referenced in logs to understand *why* the crash happened.
- **⚡ Self-Healing**: Can generate Pull Requests or apply patches directly (CLI mode).
- **🛡️ Battle-Tested**: Includes "Sandbox Mode" to safely test remediation logic.

---

## 🚀 Quick Start (CLI Tool)

For developers who want to fix bugs in their local environment or CI pipeline.

### 1. Install
```bash
pip install responseiq
```

### 2. Configure Credentials
ResponseIQ requires access to an LLM provider to reason about your code.

*Currently supported: OpenAI*

```bash
export OPENAI_API_KEY="sk-..."
```

### 3. Usage Examples

**Example A: Analyze Local Logs**
Scan a directory of log files and get a report of active incidents.
```bash
responseiq --mode scan --target ./var/log/app/
```

**Example B: The "Magic Fix"**
Analyze logs AND the current source code to generate a patch.
```bash
# Finds errors in logs, locates the source file, and explains the fix
responseiq --mode fix --target ./logs/error.log
```

**Example C: CI/CD Pipeline Integration**
Run ResponseIQ as a step in your GitHub Action to auto-triage build failures.
```bash
# In your workflow
responseiq --mode scan --target ./build_logs.txt >> summary.md
```

---

## 🏢 Platform Server (Self-Hosted)

For Platform Engineers who want to host a centralized incident response API (Webhook receiver for Datadog, PagerDuty, etc.).

### Prerequisites
- Docker & Docker Compose
- OpenAI API Key configured in `.env`

### Running with Docker
```bash
# 1. Start the API and Database
docker-compose up -d

# 2. The API is now available at http://localhost:8000
curl http://localhost:8000/health
```

### Development Setup (Local)
We use [UV](https://github.com/astral-sh/uv) for lightning-fast dependency management.

```bash
# Install dependencies
uv sync

# Run the API server with hot-reload
uv run uvicorn src.app:app --reload
```

---

## 🧪 Development & Contributing

### Workflow
1. **Linting**: `make lint`
2. **Testing**: `make test`
3. **Format**: `make format`

### Project Structure
* `src/cli.py`: Entry point for the CLI tool.
* `src/app.py`: Entry point for the API Server.
* `src/services/remediation_service.py`: The core "Brain" that interfaces with the LLM.

### License
MIT

---

## ⚠️ Disclaimer & Liability

This tool uses **Generative AI** to suggest infrastructure and code fixes.
By using ResponseIQ, you acknowledge that:
1.  **AI Can Hallucinate:** The suggestions provided may be syntactically correct but functionally wrong or insecure.
2.  **Human Review is Mandatory:** You must strictly review all Pull Requests or patches generated by this tool before deploying them.
3.  **No Warranty:** As per the [MIT License](LICENSE), the authors assume **no liability** for system outages, data loss, or security vulnerabilities resulting from the use of this software.

*For security reporting instructions, please see [SECURITY.md](docs/SECURITY.md).*