> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alshival.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Logging, cloud level control, and MCP helper usage in Python

## Configure

```python theme={null}
import alshival

alshival.configure(
    username='your_username',
    api_key='your_api_key',
    resource='https://alshival.dev/u/resource_owner_username/resources/resource_uuid/',  # paste Resource URL from DevTools Resource Details
    cloud_level='ALERT',
    debug=False,
)
```

Set `resource` to the exact **Resource URL** shown on the DevTools Resource Details page. The owner in that URL may be another user when a resource is shared with you.

## Disable cloud forwarding

```python theme={null}
alshival.configure(cloud_level='NONE')
```

Accepted `cloud_level` values: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `ALERT`, `NONE`.

## Logging

```python theme={null}
import logging
import alshival

logging.basicConfig(level=logging.INFO)

alshival.log.info('local logging flow')
alshival.log.warning('forwarded when cloud_level <= WARNING')
alshival.log.error('forwarded when cloud_level <= ERROR')
alshival.log.alert('high-priority incident')
```

## MCP tool descriptors

```python theme={null}
import alshival
from openai import OpenAI

client = OpenAI()

tools = [
    alshival.mcp,
    alshival.mcp.github,
]

response = client.responses.create(
    model='gpt-5.2',
    input='Review deployment risks in my repos.',
    tools=tools,
)
```

## Notes

* `ALSHIVAL_RESOURCE` is the preferred targeting input.
* `ALSHIVAL_DEBUG=true` enables SDK diagnostics to stderr.
* Cloud-level filtering only controls cloud forwarding. It does not suppress your local logger output.
