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

# Security and Compliance

> Security controls, data handling, and compliance posture for CosmiQ in StarTree Cloud.

An agent writing and executing SQL against production data is only useful if it is safe and correct. CosmiQ builds that in at several layers, on top of StarTree Cloud's platform-wide security controls.

## Read-only by design

> [!NOTE]
>
> CosmiQ is **read-only**. It executes only `SELECT` queries and does not modify, insert, or delete data.

Every Space defaults to `read_only` policy. `INSERT`, `UPDATE`, `DELETE`, `DROP`, and `ALTER` are banned outright — not just discouraged in the prompt.

## Guardrails

| Control | Behavior |
| :- | :- |
| **Hard row and time limits** | A max-rows cap (50,000 by default) and a query timeout (240 seconds by default) stop runaway or accidental full-table scans. |
| **Columns the agent must not touch** | A Space can flag a column `do_not_use` (stale, sensitive, or wrong), so the agent never selects it, regardless of how the question is phrased. |
| **Turn ceiling** | Each question is capped at 15 agent turns as a safety limit, independent of Space policy. |
| **Follow the rules, do not guess** | The agent's instructions tell it what to do on failure — a missing table means stop, not speculate; a SQL error means fix and retry, not invent a workaround. |
| **Prefer verified SQL** | When a curated example closely matches the question, the agent reuses or adapts it instead of improvising from scratch. |
| **Full audit trail** | Every question, generated SQL statement, and answer is logged per conversation for review, compliance, and accuracy tracking. |

## Data handling

### Reasoning stays in your AWS boundary

CosmiQ's agent runs on **Claude via AWS Bedrock**, using the Claude Agent SDK. There is no external LLM dependency — prompts and reasoning do not leave AWS. An optional LiteLLM gateway can sit in front of Bedrock for centralized spend metering without changing how the agent processes data.

### Storage

Spaces, verified queries, and feedback are stored in a file backend for local development and **MariaDB** in production. Rendered Space contexts are cached for 5 minutes by default to avoid re-processing on every question — the cache holds rendered context, not raw query results.

### Authentication

| Control | Behavior |
| :- | :- |
| **Sign-in** | Auth0, with a signed session cookie (`access_token`) |
| **Session lifetime** | 8 hours by default |
| **API / MCP clients** | Bearer JWT, sharing the same underlying session as the chat UI |
| **Authorization** | Governed by Space scope — a Space only exposes the tables it was explicitly configured with, enabling safe multi-tenant use of the same Pinot cluster |

## Platform compliance

CosmiQ runs within StarTree Cloud infrastructure and inherits platform certifications:

* **SOC 2 Type 2**
* **ISO 27001**
* **HIPAA readiness**

For full platform security details, see [Security and Compliance](https://docs.startree.ai/getstarted/deployment/security_certifications.md).

## Related documentation

> **[CosmiQ Overview](https://docs.startree.ai/corecapabilities/ai/cosmiq/overview.md)**
>
> What CosmiQ is, how Spaces work, and the deployment architecture.

> **[API Reference](https://docs.startree.ai/corecapabilities/ai/cosmiq/api-reference.md)**
>
> REST endpoints, authentication, and system defaults.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.