# Python SDK: Blocking or asyncio. Fully typed.

The kaabist package covers the whole API for Python 3.11 and later, with typed models, pages that fetch as you iterate, and a wait that can answer a job's questions as it goes.

## Setup

```sh
pip install kaabist
```

## Run and wait

Create a job, then wait for it. on_input supplies a value the job asked for; on_attention decides what happens when it needs attention.

```
from kaabist import Kaab

with Kaab() as kaab:  # KAAB_API_KEY
    job = kaab.jobs.create(program="renew-subscription@production",
                           inputs={"account": "A-1042"})
    done = kaab.jobs.wait(
        job.id,
        on_input=lambda request, job: ask_for_code(request.prompt),
    )
```

## Async, the same way

AsyncKaab has the same methods for asyncio code, and lists iterate across pages as you go.

```
from kaabist import AsyncKaab

async with AsyncKaab() as kaab:
    async for proposal in kaab.proposals.list(status="pending"):
        print(proposal.id)
```

Guide: http://localhost:3001/guides/sdks
