Metadata-Version: 2.4
Name: nozie
Version: 0.2.1
Summary: Your code, always running. Nozie fixes itself.
Author: Nozie
License: MIT
Project-URL: Homepage, https://nozie.yerikov.tech
Keywords: docker,monitoring,ai,self-healing,containers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: docker>=7.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: requests>=2.31.0
Provides-Extra: backend
Requires-Dist: anthropic>=0.25.0; extra == "backend"
Requires-Dist: PyGithub>=2.0.0; extra == "backend"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"

# Nozie

**Your code, always running. Nozie fixes itself.**

Nozie is a lightweight monitoring probe for Docker containers. Drop it into any project — it watches your containers, detects errors in logs, and sends them to the Nozie backend where AI analysis and automatic GitHub fix PRs happen.

No AI keys or GitHub tokens needed on your server. The agent is just a thin probe.

## Install

```bash
pip install nozie
```

## Quick Start

```python
import time
from nozie import NozieAgent

NozieAgent(api_key="nz_k_...").start()

# Keep your process alive
while True:
    time.sleep(1)
```

## Docker

Add a dedicated container to your `docker-compose.yml`:

```yaml
services:
  nozie-agent:
    image: python:3.11-slim
    command: python main.py
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock  # required
    environment:
      - NOZIE_API_KEY=nz_k_...
```

Or build your own image:

```dockerfile
FROM python:3.11-slim
RUN pip install nozie
COPY main.py .
CMD ["python", "main.py"]
```

```python
# main.py
import time
from nozie import NozieAgent

NozieAgent(api_key="nz_k_...").start()

while True:
    time.sleep(1)
```

## Configuration

| Parameter | Default | Description |
|---|---|---|
| `api_key` | required | Your Nozie API key from the dashboard |
| `container` | `None` | Specific container name to monitor. `None` = all containers |
| `stats_interval` | `30` | Seconds between heartbeat stats reports |
| `error_cooldown` | `60` | Minimum seconds between error reports per container |

## How It Works

1. Agent connects to the local Docker daemon via socket
2. Streams logs from all running containers (or a specific one)
3. Detects `ERROR`, `Exception`, `Traceback`, `FATAL` keywords
4. Sends the last 50 log lines to the Nozie backend
5. Backend runs AI analysis and opens a GitHub PR with the fix

The agent runs entirely in background daemon threads — it never blocks your application.

## Requirements

- Python >= 3.8
- Docker socket access (`/var/run/docker.sock`)

## License

MIT
