You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/explorer/index.md
+46-5Lines changed: 46 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,12 @@ title: Overview
6
6
7
7
<divclass='subtitle'>Learn how to upload your AI agent traces to the Invariant Explorer</div>
8
8
9
-
This quickstart guide will walk you through the process of setting up the Invariant SDK to upload your AI agent traces to the <imgclass='inline-invariant'src="assets/logo.svg"/> [Invariant Explorer](https://explorer.invariantlabs.ai).
9
+
This quickstart guide will walk you through the process of setting up the Invariant SDK to upload your AI agent traces to the <imgclass='inline-invariant'src="assets/logo.svg"/> [Invariant Explorer](https://explorer.invariantlabs.ai).
10
10
11
11
You can use Explorer to visualize, analyze, and collaborate on your AI agent traces, as well as compare them with other agents and models.
12
12
13
13

14
+
14
15
<center>Viewing agent traces in Explorer</center>
15
16
16
17
## 1. Create an Explorer Account
@@ -29,17 +30,57 @@ Make note of your API key, as you will need it to authenticate your uploads. If
29
30
export INVARIANT_API_KEY=<your-api-key>
30
31
```
31
32
32
-
## 3. Install the Invariant SDK
33
+
## 3. Upload Your Traces
34
+
35
+
You can now upload your AI agent traces to the Invariant Explorer.
36
+
37
+
For this, you have two options: (A) Automatic upload via the Invariant Gateway, or (B) manual upload via the Invariant SDK.
38
+
39
+
### Option A: Using Invariant Gateway for Automatic Tracing
40
+
41
+
The recommended way for frictionless ingestion of your traces is to use the [Invariant Gateway](../gateway/index.md). This is a hosted service that automatically ingests your traces and makes them available in Explorer.
42
+
43
+
To do so, Gateway proxies your LLM provider like OpenAI (forwarding the request and response behind the scenes) and then extracts the relevant information from the LLM responses to create a trace, automatically making it available in Explorer.
{"role": "user", "content": "What is the capital of France?"},
60
+
],
61
+
)
62
+
print("result: ", result)
63
+
```
64
+
65
+
To learn more about using Gateway, check out the [Gateway documentation](../gateway/index.md). This also includes instructions for self-hosting and alternative LLM providers.
66
+
67
+
To determine the dataset name, replace `my-first-dataset` in the URL with the name of your dataset.
68
+
69
+
### Option B: Use the Invariant SDK
70
+
71
+
If, instead, you want more control over the shape and content of your traces, you can also use the manual upload method via the Invariant SDK.
72
+
73
+
#### B.1 Install the SDK
33
74
34
-
Next, install the Invariant SDK in your Python environment, by running the following command. See [Installation](api/sdk-installation.md) for alternative methods using different package managers.
75
+
First, install the Invariant SDK in your Python environment, by running the following command. See [Installation](api/sdk-installation.md) for alternative methods using different package managers.
35
76
36
77
```bash
37
78
pip install invariant-sdk
38
79
```
39
80
40
81
> **Self-Host** Note that for the self-hosted version of Explorer, you will need to [configure the SDK](./self-hosted.md/#usage-and-access) to point to your custom endpoint.
41
82
42
-
##4. Prepare Your Traces and Upload
83
+
#### B.2 Prepare Your Traces and Upload
43
84
44
85
Now, you can start preparing your AI agent traces for upload. The Invariant SDK then provides a `Client` class that you can use to upload your traces in an Invariant-compatible format:
45
86
@@ -82,7 +123,7 @@ To learn more about the expected trace format see the chapter on the [trace form
82
123
83
124
## Work With Your Traces in Explorer
84
125
85
-
You can now navigate to the following URL to view your uploaded traces:
126
+
After uploading your traces, you can now navigate to the following URL to view your uploaded traces:
0 commit comments