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

# Ajna Cloud SDK

> Shared Python library for Ajna serverless backends

# Ajna Cloud SDK

The `ajna-cloud-sdk` is a core internal Python library designed to handle repetitive backend tasks across the entire suite of Ajna and Ibex services. It minimizes boilerplate code by centralizing authentication, logging, and database connectivity.

## Architectural Role

As a foundational SDK rather than a standalone deployable service, it is pulled in as a PIP dependency by services such as `ibex-data-platform`, `ibex-ai-service`, and Lambda functions.

### Core Modules

* **`ajna_sdk.ibex`**: A highly optimized IbexDB client equipped with request caching, direct Lambda invocation routing, and batch operation support for high-throughput telemetrics.
* **`ajna_sdk.auth`**: Provides a drop-in `@require_auth` decorator capable of validating JWTs from multiple sources including local SQLite testing databases and AWS Cognito User Pools.
* **`ajna_sdk.logger`**: Standardizes structured JSON logging across the platform, injecting execution context and request IDs to enable distributed tracing.
* **`ajna_sdk.http`**: Provides standardized HTTP response formats and CORS boundary management specifically tailored for AWS Lambda integrations.

## Integration & Configuration

The SDK operates extensively on environment variables to control its behavior without code changes across `development`, `staging`, and `production` environments:

* `IBEX_API_URL` / `IBEX_API_KEY`: Connection strings for the primary database.
* `AUTH_MODE`: Dynamically toggle between `local`, `cognito`, and `test`.
* `COGNITO_USER_POOL_ID`: Secures the boundary when deployed in the cloud.
