Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ python-ai-sdk/
│ └── utils.py # Shared helpers (new_context, write_output)
├── packages/
│ ├── client/ # launchdarkly-ai-server — core client (Tier 0)
│ ├── ai/ # launchdarkly-ai — convenience barrel re-export
│ ├── ai/ # launchdarkly-ai-python — convenience barrel re-export
│ ├── claude-agents/ # launchdarkly-ai-claude-agents
│ ├── claude-messages/ # launchdarkly-ai-claude-messages
│ ├── openai-agents/ # launchdarkly-ai-openai-agents
Expand Down Expand Up @@ -95,7 +95,7 @@ Tier 0 — Core Client (launchdarkly-ai-server)
### 1. Install

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

`launchdarkly-ai` is a thin barrel that re-exports all of `launchdarkly-ai-server`. `init_client()` auto-discovers `launchdarkly-server-sdk` at runtime — no extra setup required.
Expand Down
14 changes: 7 additions & 7 deletions packages/ai/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# `launchdarkly-ai`
# `launchdarkly-ai-python`

Convenience barrel package for the LaunchDarkly AI Python SDK. Re-exports the complete public API of [`launchdarkly-ai-server`](../client/README.md) — install this instead of `launchdarkly-ai-server` for the simplest setup.

## Installation

```bash
pip install launchdarkly-ai launchdarkly-ai-openai-messages
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[otel]"
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` instead of `launchdarkly_ai_server`:
Import everything from `launchdarkly_ai_python` instead of `launchdarkly_ai_server`:

```python
import asyncio
from launchdarkly_ai import config, graph, resolve_graph
from launchdarkly_ai import init_client, shutdown, global_registry
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():
Expand All @@ -43,7 +43,7 @@ asyncio.run(main())
Reads an AI Config flag variation **without invoking any AI provider**. Re-exported from `launchdarkly-ai-server` — see the [full reference there](../client/README.md#inspect_configkey-context).

```python
from launchdarkly_ai import inspect_config
from launchdarkly_ai_python import inspect_config

result = await inspect_config("my-ai-config-flag", {"kind": "user", "key": "user-123"})
if result["enabled"]:
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Install the OTel packages alongside this package:
```sh
pip install "launchdarkly-ai[otel]"
# or:
pip install launchdarkly-ai opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
pip install launchdarkly-ai-python opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
```

Once the OTel packages are installed, spans from all handler packages are automatically collected when `init_client()` runs.
Expand All @@ -69,7 +69,7 @@ For OTLP endpoint configuration see the [`launchdarkly-ai-server` agents.md](../
- **You don't need to call it** — lazy init runs automatically on the first `config().invoke()` call as long as `LD_SDK_KEY` is set.
- **Call it explicitly** when you need custom `serviceName`/`environment`, a custom OTLP endpoint, or want to pre-warm the connection before the first user request:
```python
from launchdarkly_ai import init_client
from launchdarkly_ai_python import init_client
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **For BYOC / custom runtimes**, use `launchdarkly-ai-server` directly and pass a pre-initialized client: `await init_client(my_custom_client)`. Do not use this package for custom runtimes — it carries `launchdarkly-server-sdk` as a hard dependency which may conflict.
Expand Down
6 changes: 3 additions & 3 deletions packages/ai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[project]
name = "launchdarkly-ai"
name = "launchdarkly-ai-python"
version = "0.0.0"
requires-python = ">=3.12"
dependencies = ["launchdarkly-ai-server"]
description = "LaunchDarkly AI SDK for Python — convenience wrapper"
description = "LaunchDarkly AI SDK for Python — convenience barrel re-export"
readme = "README.md"
license = "Apache-2.0"
authors = [{name = "LaunchDarkly", email = "team@launchdarkly.com"}]
Expand All @@ -30,4 +30,4 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/launchdarkly_ai"]
packages = ["src/launchdarkly_ai_python"]
10 changes: 5 additions & 5 deletions packages/ai/tests/test_reexports.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Tests for §5 launchdarkly-ai re-export barrel.
Tests for §5 launchdarkly-ai-python re-export barrel.
Reference: TESTING.md §5
"""

Expand All @@ -9,20 +9,20 @@
class TestReexports:
def test_all_named_exports_from_server_are_reexported(self) -> None:
server = importlib.import_module("launchdarkly_ai_server")
barrel = importlib.import_module("launchdarkly_ai")
barrel = importlib.import_module("launchdarkly_ai_python")

for name in server.__all__:
assert hasattr(barrel, name), (
f"launchdarkly_ai is missing re-export: {name!r}"
f"launchdarkly_ai_python is missing re-export: {name!r}"
)

def test_reexported_values_are_identical_references(self) -> None:
server = importlib.import_module("launchdarkly_ai_server")
barrel = importlib.import_module("launchdarkly_ai")
barrel = importlib.import_module("launchdarkly_ai_python")

for name in server.__all__:
server_obj = getattr(server, name)
barrel_obj = getattr(barrel, name)
assert server_obj is barrel_obj, (
f"launchdarkly_ai.{name} is not the same object as launchdarkly_ai_server.{name}"
f"launchdarkly_ai_python.{name} is not the same object as launchdarkly_ai_server.{name}"
)
2 changes: 1 addition & 1 deletion packages/claude-agents/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Span names and attributes are described in [Implementation Details → Telemetry

- **Pass custom options** — `serviceName`, `environment`, or OTel configuration:
```python
from launchdarkly_ai import init_client # or launchdarkly_ai_server
from launchdarkly_ai_python import init_client # or launchdarkly_ai_server
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **Use a custom or edge runtime (BYOC path)** — pass a pre-initialized client that satisfies `LDClientInterface`:
Expand Down
2 changes: 1 addition & 1 deletion packages/claude-messages/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Span names and attributes are described in [Implementation Details → Telemetry

- **Pass custom options** — `serviceName`, `environment`, or OTel configuration:
```python
from launchdarkly_ai import init_client # or launchdarkly_ai_server
from launchdarkly_ai_python import init_client # or launchdarkly_ai_server
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **Use a custom or edge runtime (BYOC path)** — pass a pre-initialized client that satisfies `LDClientInterface`:
Expand Down
2 changes: 1 addition & 1 deletion packages/langchain-agents/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Span names and attributes are described in [Implementation Details → Telemetry

- **Pass custom options** — `serviceName`, `environment`, or OTel configuration:
```python
from launchdarkly_ai import init_client # or launchdarkly_ai_server
from launchdarkly_ai_python import init_client # or launchdarkly_ai_server
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **Use a custom or edge runtime (BYOC path)** — pass a pre-initialized client that satisfies `LDClientInterface`:
Expand Down
2 changes: 1 addition & 1 deletion packages/langchain-messages/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Span names and attributes are described in [Implementation Details → Telemetry

- **Pass custom options** — `serviceName`, `environment`, or OTel configuration:
```python
from launchdarkly_ai import init_client # or launchdarkly_ai_server
from launchdarkly_ai_python import init_client # or launchdarkly_ai_server
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **Use a custom or edge runtime (BYOC path)** — pass a pre-initialized client that satisfies `LDClientInterface`:
Expand Down
2 changes: 1 addition & 1 deletion packages/openai-agents/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Span names and attributes are described in [Implementation Details → Telemetry

- **Pass custom options** — `serviceName`, `environment`, or OTel configuration:
```python
from launchdarkly_ai import init_client # or launchdarkly_ai_server
from launchdarkly_ai_python import init_client # or launchdarkly_ai_server
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **Use a custom or edge runtime (BYOC path)** — pass a pre-initialized client that satisfies `LDClientInterface`:
Expand Down
2 changes: 1 addition & 1 deletion packages/openai-messages/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Span names and attributes are described in [Implementation Details → Telemetry

- **Pass custom options** — `serviceName`, `environment`, or OTel configuration:
```python
from launchdarkly_ai import init_client # or launchdarkly_ai_server
from launchdarkly_ai_python import init_client # or launchdarkly_ai_server
await init_client({"serviceName": "my-service", "environment": "production"})
```
- **Use a custom or edge runtime (BYOC path)** — pass a pre-initialized client that satisfies `LDClientInterface`:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ignore = [

[tool.ruff.lint.isort]
known-first-party = [
"launchdarkly_ai",
"launchdarkly_ai_python",
"launchdarkly_ai_server",
"launchdarkly_ai_claude_agents",
"launchdarkly_ai_claude_messages",
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"extra-files": [
"src/launchdarkly_ai/__init__.py"
],
"component": "launchdarkly-ai"
"component": "launchdarkly-ai-python"
},
"packages/claude-agents": {
"release-type": "python",
Expand Down
42 changes: 21 additions & 21 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading