Metadata-Version: 2.5
Name: coalex
Version: 1.27.1
Summary: Coalex Python SDK for AI governance observability
Requires-Python: >=3.11
Requires-Dist: cryptography>=42
Requires-Dist: httpx>=0.27
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20
Requires-Dist: opentelemetry-sdk>=1.20
Provides-Extra: anthropic
Requires-Dist: openinference-instrumentation-anthropic>=0.1.0; extra == 'anthropic'
Provides-Extra: auto-instrument
Requires-Dist: openinference-instrumentation-anthropic>=0.1.0; extra == 'auto-instrument'
Requires-Dist: openinference-instrumentation-bedrock>=0.1.0; extra == 'auto-instrument'
Requires-Dist: openinference-instrumentation-google-genai>=0.1.0; extra == 'auto-instrument'
Requires-Dist: openinference-instrumentation-langchain>=0.1.0; extra == 'auto-instrument'
Requires-Dist: openinference-instrumentation-llama-index>=0.1.0; extra == 'auto-instrument'
Requires-Dist: openinference-instrumentation-openai>=0.1.0; extra == 'auto-instrument'
Requires-Dist: openinference-instrumentation-vertexai>=0.1.0; extra == 'auto-instrument'
Provides-Extra: bedrock
Requires-Dist: openinference-instrumentation-bedrock>=0.1.0; extra == 'bedrock'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Provides-Extra: google-genai
Requires-Dist: openinference-instrumentation-google-genai>=0.1.0; extra == 'google-genai'
Provides-Extra: langchain
Requires-Dist: openinference-instrumentation-langchain>=0.1.0; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: openinference-instrumentation-llama-index>=0.1.0; extra == 'llamaindex'
Provides-Extra: openai
Requires-Dist: openinference-instrumentation-openai>=0.1.0; extra == 'openai'
Provides-Extra: vertexai
Requires-Dist: openinference-instrumentation-vertexai>=0.1.0; extra == 'vertexai'
Description-Content-Type: text/markdown

# coalex

Python SDK for [Coalex](https://coalex.ai) — AI governance observability for enterprises in
regulated markets.

Built on [OpenTelemetry](https://opentelemetry.io/).

## Install

```bash
pip install coalex
# or
uv add coalex
```

## Quick start

```python
import coalex

coalex.register(api_key=os.environ["COALEX_API_KEY"], service_name="my-agent")
coalex.auto_instrument()

with coalex.coalex_context(agent_id="support-agent"):
    answer = my_agent.run(question)

decision = coalex.evaluate(
    request_id=request_id,
    input={"question": question},
    output={"answer": answer},
    metrics={"answer": ["faithfulness"]},
)
```

## Diagnostics

The SDK logs under the `coalex` logger and **never configures logging for you** — a library that
calls `basicConfig` takes over your application's log configuration, which is not its to take. It
attaches a `NullHandler` and leaves the rest to you.

To see what it is doing:

```python
import logging

logging.basicConfig(level=logging.INFO)          # your application's own setup
logging.getLogger("coalex").setLevel(logging.DEBUG)
```

| Logger | What you see |
| --- | --- |
| `coalex.context` | which agent id a span was attributed to, and where it came from |
| `coalex.auto_instrument` | which frameworks were instrumented, and which were found but could not be |
| `coalex.safe_exporter` | span export failures — the first few, then a heartbeat, so a key that breaks mid-run still surfaces |
| `coalex.inventory` | whether the agent's self-declaration was accepted, and the server's reason if not |

Without raising the level you still get warnings and errors — but only through Python's *lastResort*
handler if your application configures none of its own, which prints with no timestamp, level or
logger name and cannot be filtered.

**No API key, proxy token or upstream credential reaches a log line or an exception message.**
Raising the level does not change that: it is a property of what is written, not of what is
filtered.

## Telemetry never breaks your agent

A failing Coalex endpoint drops spans; it does not raise into your code. `evaluate()` and
`resolve()` do raise, because a governance decision you asked for and did not get is not something
to swallow.

## TypeScript

There is a TypeScript SDK, and it is smaller. See
[Python vs TypeScript](https://docs.coalex.ai/sdk/parity/) before choosing.

## Documentation

<https://docs.coalex.ai>
