# mubit-sdk

Public unified SDK for Mubit.

## Install

```bash
pip install mubit-sdk
```

## Quickstart

```python
import os

from mubit import Client

client = Client(
    run_id="demo_run",
    api_key=os.environ["MUBIT_API_KEY"],
)

accepted = client.control.ingest({
    "run_id": "demo_run",
    "agent_id": "sdk-quickstart",
    "idempotency_key": "quickstart-1",
    "parallel": False,
    "items": [
        {
            "item_id": "item-1",
            "content_type": "text",
            "text": "hello mubit from control ingest",
            "payload_json": "",
            "hints_json": "",
            "metadata_json": "{\"source\":\"quickstart\"}",
        }
    ],
})

job = client.control.get_ingest_job({"run_id": "demo_run", "job_id": accepted["job_id"]})
while not job.get("done", False):
    import time

    time.sleep(0.3)
    job = client.control.get_ingest_job({"run_id": "demo_run", "job_id": accepted["job_id"]})

answer = client.control.query(
    {
        "run_id": "demo_run",
        "query": "what was ingested?",
        "mode": "agent_routed",
        "direct_lane": "semantic_search",
        "include_linked_runs": False,
        "limit": 5,
        "embedding": [],
    }
)
print(answer.get("final_answer"))
```

## Environment Variables

- Required: `MUBIT_API_KEY`
