Metadata-Version: 2.5
Name: launchdarkly-ai-python
Version: 0.4.0
Summary: LaunchDarkly AI SDK for Python — convenience barrel re-export
Project-URL: Homepage, https://github.com/launchdarkly/python-ai-sdk
Project-URL: Repository, https://github.com/launchdarkly/python-ai-sdk
Project-URL: Bug Tracker, https://github.com/launchdarkly/python-ai-sdk/issues
Author-email: LaunchDarkly <team@launchdarkly.com>
License-Expression: Apache-2.0
Keywords: ai,feature-flags,launchdarkly,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: launchdarkly-ai-server
Provides-Extra: otel
Requires-Dist: launchdarkly-ai-server[otel]; extra == 'otel'
Description-Content-Type: text/markdown

# `launchdarkly-ai-python`

Convenience barrel package for the LaunchDarkly AI Python SDK. Re-exports the complete public API of [`launchdarkly-ai-server`](https://github.com/launchdarkly/python-ai-sdk/blob/main/packages/client/README.md) — install this instead of `launchdarkly-ai-server` for the simplest setup.

## Installation

```bash
pip install launchdarkly-ai-python launchdarkly-ai-openai-messages
```

To enable trace export to the LaunchDarkly Observability dashboard, install the `otel` extras group:

```bash
pip install "launchdarkly-ai-python[otel]"
```

`init_client()` detects the OTel packages at runtime and configures tracing automatically. If the extras are not installed, a single warning is logged and all AI calls continue normally with no-op spans.

## Usage

Import everything from `launchdarkly_ai_python` instead of `launchdarkly_ai_server`:

```python
import asyncio
from launchdarkly_ai_python import config, graph, resolve_graph
from launchdarkly_ai_python import init_client, shutdown, global_registry
from launchdarkly_ai_openai_messages import create_openai_messages_handler

async def main():
    result = await config(
        key="my-ai-config-flag",
        handler=create_openai_messages_handler(),
    ).invoke("What is feature flagging?", {"kind": "user", "key": "user-123"})

    print(result.response)
    await shutdown()

asyncio.run(main())
```

## `inspect_config(key, context)`

Reads an AI Config flag variation **without invoking any AI provider**. Re-exported from `launchdarkly-ai-server` — see the [full reference there](https://github.com/launchdarkly/python-ai-sdk/blob/main/packages/client/README.md#inspect_configkey-context).

```python
from launchdarkly_ai_python import inspect_config

result = await inspect_config("my-ai-config-flag", {"kind": "user", "key": "user-123"})
if result["enabled"]:
    print(result["config"]["model"]["name"])
```

Never raises. Returns `{"enabled": bool, "config": dict | None, "meta": dict | None}`.

## Agent Skills

Agent Skills (`get_skill`, `write_skills`, `watch_skills` and the rest) are re-exported from this
package's root. They need `launchdarkly-ai-server` 1.0.0 or later, the first release with Agent
Skills in core. This package does not pin `launchdarkly-ai-server`, so upgrading it alone can leave
an older one installed, and `from launchdarkly_ai_python import get_skill` then raises
`ImportError`. Upgrade both:

```bash
pip install --upgrade launchdarkly-ai-python "launchdarkly-ai-server>=1.0.0"
```

## Experimental features

Experimental features are not re-exported from this package. They live in
`launchdarkly-ai-server`, the package this one depends on, and need a `launchdarkly-ai-server`
release that includes them. Import them from `launchdarkly_ai_server.experimental`; if that
import fails, upgrade `launchdarkly-ai-server` itself, since upgrading this package alone can
leave an older `launchdarkly-ai-server` in place. The experimental feature is:

- **Evaluations from Code**, in `launchdarkly_ai_server.experimental.evaluations`; see the
  [evaluations guide](https://github.com/launchdarkly/python-ai-sdk/blob/main/packages/client/README.md#run-an-evaluation-from-code-experimental).

---

All exports, types, and behaviors are identical to `launchdarkly-ai-server`. See the [core client README](https://github.com/launchdarkly/python-ai-sdk/blob/main/packages/client/README.md) for the full API reference.
