> For the complete documentation index, see [llms.txt](https://layerlens.gitbook.io/stratix-python-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://layerlens.gitbook.io/stratix-python-sdk/getting-started/quickstart.md).

# Quick Start Guide

This guide walks you through the most common SDK workflows.

## Setup

```bash
pip install layerlens --extra-index-url https://sdk.layerlens.ai/package
export LAYERLENS_STRATIX_API_KEY="your-api-key"
```

## Run a Benchmark Evaluation

```python
from layerlens import Stratix

client = Stratix()

# Get a model and benchmark by key
model = client.models.get_by_key("openai/gpt-4o")
benchmark = client.benchmarks.get_by_key("arc-agi-2")

# Create an evaluation
evaluation = client.evaluations.create(
    model=model,
    benchmark=benchmark,
)

# Wait for results
result = client.evaluations.wait_for_completion(evaluation)
print(f"Accuracy: {result.accuracy}")
```

## Create a Judge and Evaluate Traces

```python
from layerlens import Stratix

client = Stratix()

# Create a judge
judge = client.judges.create(
    name="Response Quality Judge",
    evaluation_goal="Rate whether the response is accurate, complete, and well-structured",
)

# Upload traces from a JSON/JSONL file
upload = client.traces.upload("./my_traces.json")
print(f"Uploaded {len(upload.trace_ids)} traces")

# Run a trace evaluation
trace_eval = client.trace_evaluations.create(
    trace_id=upload.trace_ids[0],
    judge_id=judge.id,
)

# Wait for completion and get results
result = client.trace_evaluations.wait_for_completion(trace_eval.id)
if result:
    print(f"Score: {result.score}, Passed: {result.passed}")
    print(f"Reasoning: {result.reasoning}")
```

## Async Usage

Every method is available in async form via `AsyncStratix`:

```python
import asyncio
from layerlens import AsyncStratix

async def main():
    client = AsyncStratix()

    model = await client.models.get_by_key("openai/gpt-4o")
    benchmark = await client.benchmarks.get_by_key("arc-agi-2")

    evaluation = await client.evaluations.create(
        model=model,
        benchmark=benchmark,
    )

    result = await client.evaluations.wait_for_completion(evaluation)
    print(f"Accuracy: {result.accuracy}")

asyncio.run(main())
```

## Browse Public Data

```python
from layerlens import Stratix

client = Stratix()

# List public models
models = client.public.models.get()
for model in models.models:
    print(f"{model.key}: {model.name}")

# List public benchmarks
benchmarks = client.public.benchmarks.get()
for bm in benchmarks.benchmarks:
    print(f"{bm.key}: {bm.name}")
```

## Error Handling

```python
from layerlens import Stratix, NotFoundError, AuthenticationError, APIError

client = Stratix()

try:
    model = client.models.get_by_id("nonexistent-id")
except NotFoundError as e:
    print(f"Not found: {e.message}")
except AuthenticationError as e:
    print(f"Auth failed: {e.message}")
except APIError as e:
    print(f"API error ({e.status_code}): {e.message}")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://layerlens.gitbook.io/stratix-python-sdk/getting-started/quickstart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
