> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/traces-2.md).

# Traces

## Upload

Trace files are JSON or JSONL, **max 50 MB**. The SDK handles presigned-S3 upload automatically (3-step: presigned URL → S3 PUT → trace record creation).

```python
result = client.traces.upload("./my_traces.json")
print(f"Uploaded {len(result.trace_ids)} traces: {result.trace_ids}")
```

## Get one

```python
trace = client.traces.get(trace_id)
# Trace fields: id, organization_id, project_id, created_at, filename,
# data (Dict[str, Any]), input, integration_id
```

## List with filters

```python
response = client.traces.get_many(
 page=1, page_size=50,
 source="...", # filter by source
 judge_id="...", # traces evaluated by this judge
 status="...",
 time_range={"from": "...", "to": "..."},
 search="...",
 sort_by="created_at",
 sort_order="desc",
)
# response.traces,.total_count,.count
```

## Delete

```python
client.traces.delete(trace_id)
```

## List sources

```python
sources = client.traces.get_sources()
```

## Trace shape

The `data` field is a flexible `Dict[str, Any]` — Stratix doesn't enforce a specific span schema. For agent traces, common conventions:

* `inputs` (top-level) — request context
* `outputs` (top-level) — final response
* `spans` (list) — child operations (LLM calls, tool calls, retrieval)

For **auto-instrumented** traces emitted by `layerlens.instrument`, the spans follow the canonical event types: `model.invoke`, `cost.record`, `tool.call`, `policy.violation`. See [Integrations](/6.-build-wire-your-code/sdk-python.md).

## File formats

`.json` and `.jsonl` only. For larger datasets, split into chunks ≤50 MB each.

## Async

All methods have `AsyncStratix` equivalents.

## See also

* [Concept: Traces and spans](/6.-build-wire-your-code/traces-and-spans.md)
* [Trace evaluations](/more-in-this-section-9/trace-evaluations-1.md)
* [Tutorial: First trace](/2.-get-started/first-trace.md)
* [SDK sample: `basic_trace.py`](https://github.com/layerlens/stratix-python/blob/main/samples/core/basic_trace.py)


---

# 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://docs.layerlens.ai/more-in-this-section-9/traces-2.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.
