For the complete documentation index, see llms.txt. This page is also available as Markdown.

Python SDK — auto-instrumentation

Stratix Python SDK reference — Stratix, AsyncStratix, complete resource surface, errors.

pip install layerlens --extra-index-url https://sdk.layerlens.ai/package. Sync and async. Source available at stratix-python.

Client classes

The SDK exposes four public client classes, all backed by the same API:

  • Stratix — primary sync client (authenticated, full surface)

  • AsyncStratix — primary async client (authenticated, full surface)

  • PublicClient — read-only client over the public catalog (no auth required)

  • AsyncPublicClient — async variant of PublicClient

from layerlens import Stratix, AsyncStratix, PublicClient, AsyncPublicClient

Resources

Client configuration

Stratix / AsyncStratix constructors, env vars, retries.

Public client

`client.public.*` and `PublicClient` for catalog access.

Models and benchmarks

`client.models`, `client.benchmarks` — get, get_by_key, add, create_custom, create_smart.

Evaluations

`client.evaluations` — create, wait_for_completion, get_many.

Scorers

`client.scorers` — LLM-backed graders.

Judges

`client.judges` — create, get, get_many, update, delete.

Judge optimizations

`client.judge_optimizations` — estimate, create, get, apply.

Traces

`client.traces` — upload, get, get_many, delete, get_sources.

Trace evaluations

`client.trace_evaluations` — create, get, get_results, estimate_cost.

Results

`client.results` — get, get_all.

Comparisons

`client.public.comparisons` — compare, compare_models.

(see public-client)

Errors

Full exception hierarchy.

Auto-instrumentation

The layerlens.instrument subpackage provides drop-in instrumentation for LLM provider clients and supported frameworks. Importing instrument_openai(), instrument_anthropic(), or framework callbacks like LangChainCallbackHandler wraps the client so trace data is emitted automatically as your code runs.

See Integrations for the production adapter list and framework integration pages for setup details.

Authentication

Environment variables:

Variable
Default
Notes

LAYERLENS_STRATIX_API_KEY

(required)

Primary API key env var

LAYERLENS_STRATIX_BASE_URL

https://api.layerlens.ai/api/v1

Override for self-hosted / staging deployments

Sync vs async

Every resource is available in both sync (Stratix) and async (AsyncStratix) clients.

Quick reference — every public method by resource

The exact signatures are in each per-resource page below.

Adapters · CLI · Examples · Security · Troubleshooting

Deeper SDK material ported from the stratix-python repo:

Adapters

Per-framework + per-provider instrumentation guides (LangChain, LlamaIndex, CrewAI, OpenAI, Anthropic, Bedrock,...). Also: OTLP sink, Pydantic v1/v2 matrix, certification suite, testing.

CLI

`stratix` CLI — getting started, full command reference, 15 workflow recipes.

Examples

Runnable samples for evaluations, judges, traces, models, public catalog.

Security

API key management, data privacy, environment variables, rate limiting.

Troubleshooting

Authentication, common issues, error codes reference.

Where to next

Last updated

Was this helpful?