Metadata-Version: 2.4
Name: aida-sdk
Version: 1.0.1
Summary: AIDA — AI DevOps Incident Intelligence SDK. Auto-captures logs, errors, and exceptions, streams them to your AIDA backend, and triggers AI-powered incident analysis.
Project-URL: Homepage, https://github.com/your-org/aida-sdk
Project-URL: Documentation, https://docs.aida.dev
Project-URL: Repository, https://github.com/your-org/aida-sdk
Author: AIDA Team
License: MIT
Keywords: ai,devops,incident,logging,observability
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# aida-sdk

> AI DevOps Incident Intelligence SDK for Python.
> Auto-captures logs, errors, and exceptions — triggers AI-powered incident analysis automatically.

## Install

```bash
pip install aida-sdk
```

## Quick Start

```python
import aida

aida.init(
    api_key="sk-...",          # from GET /api/v1/sdk/keys
    project_id="owner/my-repo",  # your GitHub repo full name
    repo_name="owner/my-repo",
    base_url="https://your-aida-backend.com",
    environment="production",
    service="my-backend-api",
)

# ✅ After this line — ALL print() and logging output is auto-captured.
# ✅ Uncaught exceptions are auto-captured and trigger the incident pipeline.
# ✅ Error-level entries automatically trigger the 4-agent AI analysis.

print("Server started")          # → captured as info log
import logging
logging.error("DB connection failed")  # → captured as error, triggers incident AI
raise ValueError("Something broke")    # → captured as error with traceback
```

## What Gets Captured Automatically

| Source | Level | Notes |
|---|---|---|
| `print()` | info | All stdout output |
| `sys.stderr` | error | All stderr output |
| `logging.debug/info/warning/error` | mapped | Full logging module |
| Uncaught exceptions | error | Includes full traceback |

## Manual Logging (Optional)

```python
aida.get_client().error("Payment gateway timeout", metadata={"gateway": "stripe", "latency_ms": 5000})
aida.get_client().info("User signed up", metadata={"user_id": "123"})
```

## Configuration

| Parameter | Default | Description |
|---|---|---|
| `api_key` | required | Bearer token from `/api/v1/sdk/keys` |
| `project_id` | required | Repo full name for linking logs to incidents |
| `repo_name` | required | Same as project_id |
| `base_url` | required | Your backend URL |
| `environment` | `"production"` | Environment tag |
| `service` | `"app"` | Service name tag |
| `batch_size` | `20` | Max logs per HTTP request |
| `flush_interval` | `2.0` | Seconds between flushes |
| `intercept_stdout` | `True` | Capture `print()` |
| `intercept_logging` | `True` | Capture `logging` module |
| `intercept_exceptions` | `True` | Capture uncaught exceptions |

## Publish to PyPI

CI publish (GitHub Actions):
- Tag the repo with `python-sdk-v*` or run `workflow_dispatch`.
- Required secret: `PYPI_API_TOKEN`.

```bash
cd python-sdk
pip install build twine
python -m build
twine upload dist/*
```
