Metadata-Version: 2.5
Name: stackgen-sdk
Version: 0.1.5
Summary: StackGen SDK — Aiden, SRE, and Vault from one client
Project-URL: Homepage, https://appcd-dev.github.io/stackgen-sdk/
Project-URL: Documentation, https://appcd-dev.github.io/stackgen-sdk/
Project-URL: Repository, https://github.com/appcd-dev/stackgen-sdk
Project-URL: Bug Tracker, https://github.com/appcd-dev/stackgen-sdk/issues
Author: StackGen
License-Expression: Apache-2.0
Keywords: aiden,openapi,sre,stackgen
Requires-Python: >=3.10
Requires-Dist: pydantic>=2.0
Requires-Dist: python-dateutil>=2.8
Requires-Dist: typing-extensions>=4.0
Requires-Dist: urllib3>=2.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# StackGen Python SDK

**Documentation:** [https://appcd-dev.github.io/stackgen-sdk/](https://appcd-dev.github.io/stackgen-sdk/) — Aiden guide, code samples, FAQ, and CI integration.

Install:

```bash
pip install stackgen-sdk
```

Import package name is `stackgen`. Construct the client with an explicit config:

```python
from pathlib import Path
from stackgen import StackgenClient, StackgenConfig

client = StackgenClient(
    StackgenConfig(
        base_url="https://azure-eu.cloud.stackgen.com",
        api_token="stackgen_…",
        org_id="<project-uuid>",
        webhook_token="sg_aios_…",  # webhook journeys only
    )
)

result = client.aiden.run_webhook_and_download_report(
    Path("alert.json").read_text(encoding="utf-8")
)
print(result.session_id, result.output_path)

ask = client.aiden.run_ask_and_download_artifact(
    message="Run triage for checkout CPU alert",
    entity_refs=[{"name": "observe-uber-triage", "type": "workflow"}],
)
print(ask.trace_id, ask.output_path)

alerts = client.sre.list_alerts()
```

## Default environment variables

`StackgenConfig.from_env()` reads **only** these (optional convenience):

| Variable | Purpose |
|----------|---------|
| `STACKGEN_URL` | Mothership URL (no path suffix) |
| `STACKGEN_TOKEN` | API token (`stackgen_…`) |
| `STACKGEN_PROJECT` | Project / org UUID (`orgId`) |

Pass `webhook_token`, `webhook_id`, timeouts, and artifact paths as `StackgenConfig` fields — not via env.

```python
from dataclasses import replace
from stackgen import StackgenClient, StackgenConfig

client = StackgenClient(
    replace(StackgenConfig.from_env(), webhook_token="sg_aios_…")
)
```

## Namespaces

- `client.aiden` — webhooks, Ask Guild, sessions, artifact download
- `client.sre` — alerts and investigations
- `client.vault` — secrets (not enabled in this release)

Prefer `StackgenClient` over `stackgen.generated`.

Pin versions in CI: `pip install stackgen-sdk==0.1.5`.

**Documentation:** [https://appcd-dev.github.io/stackgen-sdk/](https://appcd-dev.github.io/stackgen-sdk/) (Aiden guide, [FAQ](https://appcd-dev.github.io/stackgen-sdk/faq/), [code samples](https://appcd-dev.github.io/stackgen-sdk/code-samples/))
