# Dylos Suppression Settings Service

## PURPOSE
A multi-tenant settings and auth service that stores per-agent background-speaker
suppression configuration and forwards calls to the Dylos suppression API. In the video
the presenter configures suppression in the playground and notes that the same control —
including a *dynamic* mode where the agent chooses how much to suppress — is available
**via the API**. This project is the backend that makes that API story real: tenant
accounts, API keys, per-agent config rows, and an outbound client to the vendor.

## WHY THIS MATTERS
Turning a demo toggle into a product means persistence, identity, and an integration
boundary. Whoever calls the API has to be authenticated, and their chosen mode and level
must survive restarts and apply to the right agent. This project teaches the unglamorous
but essential plumbing behind the one-click feature shown on screen.

## HOW TO BUILD
Use SQLAlchemy for the data layer, FastAPI for the endpoints, and httpx for the outbound
Dylos call. Steps: (1) define `Tenant`, `ApiKey`, and `SuppressionConfig` tables;
(2) issue and hash API keys; (3) expose `PUT /agents/{id}/suppression` guarded by a key
dependency; (4) on a call, POST the config to the Dylos endpoint with httpx and record
the result. Key snippet:

```python
async def call_dylos(cfg: SuppressionConfig, key: str) -> dict:
    async with httpx.AsyncClient(base_url=DYLOOS_BASE) as client:
        r = await client.post(
            "/v1/suppression",
            headers={"Authorization": f"Bearer {key}"},
            json={"mode": cfg.mode, "level": cfg.level},
        )
        r.raise_for_status()               # TODO: retries + backoff
        return r.json()
```

## WHEN TO USE IN PRODUCTION
Use it in contact-center platforms that need per-agent suppression policy, resellers who
must isolate tenants, and any integration that stores vendor credentials centrally. It is
the right layer when compliance requires an audit trail of who changed which setting. Do
**not** use it for single-user local scripts — overkill. Avoid storing vendor keys
unhashed or in the same table as tenant data.

## HOW IT HELPS STUDENTS
Builds real skills in SQLAlchemy models, FastAPI dependency-injected auth, secrets
handling, and resilient httpx integration — the exact work of a voice-infra backend role.

## STARTER CODE
See `starter/main.py` for a runnable skeleton using SQLite, hashed keys, and a mock Dylos.
