Metadata-Version: 2.4
Name: ascii_box_sdk
Version: 0.0.5
Summary: Box Public API v1
Home-page: https://docs.ascii.dev/box/sdks
Author: OpenAPI Generator community
Author-email: OpenAPI Generator Community <team@openapitools.org>
License-Expression: MIT
Project-URL: Homepage, https://box.ascii.dev
Project-URL: Documentation, https://docs.ascii.dev/box/sdks
Project-URL: Reference, https://docs.ascii.dev/box/api/reference
Keywords: OpenAPI,OpenAPI-Generator,Box Public API v1
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: urllib3<3.0.0,>=2.1.0
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: pydantic>=2.11
Requires-Dist: typing-extensions>=4.7.1
Dynamic: author
Dynamic: home-page
Dynamic: license-file

# ascii-box-sdk

Use Box from your application code.

## Install

```bash
pip install ascii-box-sdk
```

## Links

- SDK docs: https://docs.ascii.dev/box/sdks
- API reference: https://docs.ascii.dev/box/api/reference
- Dashboard: https://box.ascii.dev/dashboard
- API keys: https://box.ascii.dev/box/dashboard?tab=api-keys

## Flow

1. Create an API key in the Box dashboard.
2. Create or resume a Box.
3. Prompt the Box.
4. Read events until the work is done.
5. Open desktop access when you need browser or GUI visibility.
6. Stop, resume, fork, or delete the Box according to your retention policy.

## Notes

- Put cleanup in `finally`: stop/archive or delete Boxes you create for tests.
- Treat API key secrets, Box secrets, SSH keys, and desktop stream URLs as sensitive.
- `updateSecrets` / `update_secrets` replaces the entire secret setup. Read the current setup first and send every env var and secret file that should remain.
- `rotateApiKey` / `rotate_api_key` rotates the raw secret in place. Store the returned secret immediately; it is shown once.
- Repository selection is idempotent. Selecting an already-selected repository updates its base branch.

## Example

```python
import os
import time

from ascii_box_sdk import ApiClient, Configuration
from ascii_box_sdk.api.box_api import BoxApi
from ascii_box_sdk.models.create_box_request import CreateBoxRequest
from ascii_box_sdk.models.prompt_request import PromptRequest
from ascii_box_sdk.models.update_box_request import UpdateBoxRequest

config = Configuration(
    host=os.getenv("BOX_BASE_URL", "https://ascii.dev/api/box/v1"),
    access_token=os.environ["BOX_API_KEY"],
)

box_id = None
with ApiClient(config) as client:
    box = BoxApi(client)

    try:
        created = box.create(CreateBoxRequest(ttl_seconds=1800))
        box_id = created.box.id

        box.update(box_id, UpdateBoxRequest(name="sdk-demo"))

        while box.get(box_id).box.state not in {"ready", "idle"}:
            time.sleep(2)

        box.prompt(
            box_id,
            PromptRequest(
                provider="codex",
                prompt="Inspect the repository and summarize the test command.",
            ),
        )

        events = box.events(box_id)
        print(events.events)
    finally:
        if box_id:
            box.stop(box_id)
```

## License

This SDK is MIT licensed. Box, the Box API, the Box CLI, and the Box product are proprietary.
