# Agent Landline Outreach Service

## PURPOSE
Once Muse has cleaned a list of providers, someone has to reach them. The video shows builders giving a Muse agent a dedicated number by connecting it to Bland AI's "agent landline" — a VoIP US number with talk and text ("I think it's 15 bucks for agent phone plan") so the agent can "call people... reach out... close sales for you". This service persists leads in a SQLAlchemy database and drives outbound calls and SMS through an httpx client, logging every attempt and outcome.

## WHY THIS MATTERS
It is the execution layer of the arbitrage: mining gives you names, cleaning gives you a list, and outreach is what converts a Level-2 list into bookings and revenue. It teaches the integration pattern — an agent that talks to a third-party telephony API — that the video calls out as today's state of play.

## HOW TO BUILD
1. Define a `Lead` ORM model and a `ContactAttempt` table (SQLAlchemy 2.0 typed mappings).
2. Build an `httpx.Client` wrapper with a base URL and bearer token.
3. Add `place_call(lead)` and `send_sms(lead)` that POST to the provider.
4. Record status ("queued", "called", "booked") with retries and backoff.
5. Expose `main()` that pulls uncalled leads and dispatches them.

```python
def place_call(client, base_url, lead):
    resp = client.post(f"{base_url}/calls", json={
        "phone": lead.phone,
        "task": f"Confirm {lead.niche} availability in {lead.city}",
    })
    resp.raise_for_status()
    return resp.json()["call_id"]
```

## WHEN TO USE IN PRODUCTION
Use it once you have more leads than you can dial by hand — a night-nurse desk in Montreal or Tampa, or a Marketplace reseller confirming pickups. It fits behind a queue worker. Do NOT use it to cold-call without consent, and always honor opt-outs and the telephony provider's compliance rules; the video itself flags checking platform terms of service before acting on mined data.

## HOW IT HELPS STUDENTS
Students practice ORM modeling, HTTP integration, secrets handling via env vars and idempotent outreach logging — the back-office skills that turn an agent demo into a real service.

## STARTER CODE
`starter/main.py` wires SQLAlchemy models, an httpx-backed `OutreachClient` supporting an injected mock transport, and a `dispatch_queued` loop with `# TODO` markers for real credentials, retries and webhook handling.
