Query traces
curl --request POST \
--url https://api.uselemma.ai/traces/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"match": {
"kind": "none",
"fields": []
},
"start_inclusive": "2023-11-07T05:31:56Z",
"end_exclusive": "2023-11-07T05:31:56Z",
"filters": {
"agent_name": "<string>",
"has_error": true,
"has_issues": true,
"tool": {
"name": null
},
"model": "<string>",
"thread_id": "<string>",
"attribute_filters": [
{
"path": "<string>",
"op": "<string>",
"value": "<string>",
"values": [
"<string>"
]
}
],
"min_spans": 1,
"max_spans": 1,
"min_duration_ms": 1,
"max_duration_ms": 1,
"min_tokens": 1,
"min_thread_traces": 2,
"max_thread_traces": 2
},
"limit": 50,
"cursor": "<string>"
}
'import requests
url = "https://api.uselemma.ai/traces/query"
payload = {
"project_id": "<string>",
"match": {
"kind": "none",
"fields": []
},
"start_inclusive": "2023-11-07T05:31:56Z",
"end_exclusive": "2023-11-07T05:31:56Z",
"filters": {
"agent_name": "<string>",
"has_error": True,
"has_issues": True,
"tool": { "name": None },
"model": "<string>",
"thread_id": "<string>",
"attribute_filters": [
{
"path": "<string>",
"op": "<string>",
"value": "<string>",
"values": ["<string>"]
}
],
"min_spans": 1,
"max_spans": 1,
"min_duration_ms": 1,
"max_duration_ms": 1,
"min_tokens": 1,
"min_thread_traces": 2,
"max_thread_traces": 2
},
"limit": 50,
"cursor": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
match: {kind: 'none', fields: []},
start_inclusive: '2023-11-07T05:31:56Z',
end_exclusive: '2023-11-07T05:31:56Z',
filters: {
agent_name: '<string>',
has_error: true,
has_issues: true,
tool: {name: null},
model: '<string>',
thread_id: '<string>',
attribute_filters: [{path: '<string>', op: '<string>', value: '<string>', values: ['<string>']}],
min_spans: 1,
max_spans: 1,
min_duration_ms: 1,
max_duration_ms: 1,
min_tokens: 1,
min_thread_traces: 2,
max_thread_traces: 2
},
limit: 50,
cursor: '<string>'
})
};
fetch('https://api.uselemma.ai/traces/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.uselemma.ai/traces/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_id' => '<string>',
'match' => [
'kind' => 'none',
'fields' => [
]
],
'start_inclusive' => '2023-11-07T05:31:56Z',
'end_exclusive' => '2023-11-07T05:31:56Z',
'filters' => [
'agent_name' => '<string>',
'has_error' => true,
'has_issues' => true,
'tool' => [
'name' => null
],
'model' => '<string>',
'thread_id' => '<string>',
'attribute_filters' => [
[
'path' => '<string>',
'op' => '<string>',
'value' => '<string>',
'values' => [
'<string>'
]
]
],
'min_spans' => 1,
'max_spans' => 1,
'min_duration_ms' => 1,
'max_duration_ms' => 1,
'min_tokens' => 1,
'min_thread_traces' => 2,
'max_thread_traces' => 2
],
'limit' => 50,
'cursor' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.uselemma.ai/traces/query"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"match\": {\n \"kind\": \"none\",\n \"fields\": []\n },\n \"start_inclusive\": \"2023-11-07T05:31:56Z\",\n \"end_exclusive\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"agent_name\": \"<string>\",\n \"has_error\": true,\n \"has_issues\": true,\n \"tool\": {\n \"name\": null\n },\n \"model\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attribute_filters\": [\n {\n \"path\": \"<string>\",\n \"op\": \"<string>\",\n \"value\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"min_spans\": 1,\n \"max_spans\": 1,\n \"min_duration_ms\": 1,\n \"max_duration_ms\": 1,\n \"min_tokens\": 1,\n \"min_thread_traces\": 2,\n \"max_thread_traces\": 2\n },\n \"limit\": 50,\n \"cursor\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.uselemma.ai/traces/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"match\": {\n \"kind\": \"none\",\n \"fields\": []\n },\n \"start_inclusive\": \"2023-11-07T05:31:56Z\",\n \"end_exclusive\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"agent_name\": \"<string>\",\n \"has_error\": true,\n \"has_issues\": true,\n \"tool\": {\n \"name\": null\n },\n \"model\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attribute_filters\": [\n {\n \"path\": \"<string>\",\n \"op\": \"<string>\",\n \"value\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"min_spans\": 1,\n \"max_spans\": 1,\n \"min_duration_ms\": 1,\n \"max_duration_ms\": 1,\n \"min_tokens\": 1,\n \"min_thread_traces\": 2,\n \"max_thread_traces\": 2\n },\n \"limit\": 50,\n \"cursor\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselemma.ai/traces/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"match\": {\n \"kind\": \"none\",\n \"fields\": []\n },\n \"start_inclusive\": \"2023-11-07T05:31:56Z\",\n \"end_exclusive\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"agent_name\": \"<string>\",\n \"has_error\": true,\n \"has_issues\": true,\n \"tool\": {\n \"name\": null\n },\n \"model\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attribute_filters\": [\n {\n \"path\": \"<string>\",\n \"op\": \"<string>\",\n \"value\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"min_spans\": 1,\n \"max_spans\": 1,\n \"min_duration_ms\": 1,\n \"max_duration_ms\": 1,\n \"min_tokens\": 1,\n \"min_thread_traces\": 2,\n \"max_thread_traces\": 2\n },\n \"limit\": 50,\n \"cursor\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"traces": [
{
"id": "<string>",
"otel_trace_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"agent_name": "<string>",
"thread_id": "<string>",
"total_duration_ms": 123,
"span_count": 1,
"has_error": true,
"score": 123,
"matching_spans": [
{
"match_id": "<string>",
"span_id": "<string>",
"span_name": "<string>",
"field": "<string>",
"attribute_path": "<string>",
"snippet": "<string>",
"rank": 123,
"span": {
"kind": "<string>",
"status_code": "<string>",
"attributes": {}
}
}
],
"root_span": {
"attributes": {},
"attributes_truncated": true
}
}
],
"next_request": {
"operation": "<string>",
"arguments": {
"project_id": "<string>",
"match": {
"kind": "none",
"fields": [
"otel_trace_id"
],
"sort": "timestamp_desc"
},
"start_inclusive": "2023-11-07T05:31:56Z",
"end_exclusive": "2023-11-07T05:31:56Z",
"filters": {
"agent_name": "<string>",
"has_error": true,
"has_issues": true,
"tool": {
"name": null
},
"model": "<string>",
"thread_id": "<string>",
"attribute_filters": [
{
"path": "<string>",
"op": "<string>",
"value": "<string>",
"values": [
"<string>"
]
}
],
"min_spans": 1,
"max_spans": 1,
"min_duration_ms": 1,
"max_duration_ms": 1,
"min_tokens": 1,
"min_thread_traces": 2,
"max_thread_traces": 2
},
"limit": 50,
"cursor": "<string>"
}
}
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}Traces
Query traces
Search a project’s traces.
POST
/
traces
/
query
Query traces
curl --request POST \
--url https://api.uselemma.ai/traces/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"match": {
"kind": "none",
"fields": []
},
"start_inclusive": "2023-11-07T05:31:56Z",
"end_exclusive": "2023-11-07T05:31:56Z",
"filters": {
"agent_name": "<string>",
"has_error": true,
"has_issues": true,
"tool": {
"name": null
},
"model": "<string>",
"thread_id": "<string>",
"attribute_filters": [
{
"path": "<string>",
"op": "<string>",
"value": "<string>",
"values": [
"<string>"
]
}
],
"min_spans": 1,
"max_spans": 1,
"min_duration_ms": 1,
"max_duration_ms": 1,
"min_tokens": 1,
"min_thread_traces": 2,
"max_thread_traces": 2
},
"limit": 50,
"cursor": "<string>"
}
'import requests
url = "https://api.uselemma.ai/traces/query"
payload = {
"project_id": "<string>",
"match": {
"kind": "none",
"fields": []
},
"start_inclusive": "2023-11-07T05:31:56Z",
"end_exclusive": "2023-11-07T05:31:56Z",
"filters": {
"agent_name": "<string>",
"has_error": True,
"has_issues": True,
"tool": { "name": None },
"model": "<string>",
"thread_id": "<string>",
"attribute_filters": [
{
"path": "<string>",
"op": "<string>",
"value": "<string>",
"values": ["<string>"]
}
],
"min_spans": 1,
"max_spans": 1,
"min_duration_ms": 1,
"max_duration_ms": 1,
"min_tokens": 1,
"min_thread_traces": 2,
"max_thread_traces": 2
},
"limit": 50,
"cursor": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
match: {kind: 'none', fields: []},
start_inclusive: '2023-11-07T05:31:56Z',
end_exclusive: '2023-11-07T05:31:56Z',
filters: {
agent_name: '<string>',
has_error: true,
has_issues: true,
tool: {name: null},
model: '<string>',
thread_id: '<string>',
attribute_filters: [{path: '<string>', op: '<string>', value: '<string>', values: ['<string>']}],
min_spans: 1,
max_spans: 1,
min_duration_ms: 1,
max_duration_ms: 1,
min_tokens: 1,
min_thread_traces: 2,
max_thread_traces: 2
},
limit: 50,
cursor: '<string>'
})
};
fetch('https://api.uselemma.ai/traces/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.uselemma.ai/traces/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_id' => '<string>',
'match' => [
'kind' => 'none',
'fields' => [
]
],
'start_inclusive' => '2023-11-07T05:31:56Z',
'end_exclusive' => '2023-11-07T05:31:56Z',
'filters' => [
'agent_name' => '<string>',
'has_error' => true,
'has_issues' => true,
'tool' => [
'name' => null
],
'model' => '<string>',
'thread_id' => '<string>',
'attribute_filters' => [
[
'path' => '<string>',
'op' => '<string>',
'value' => '<string>',
'values' => [
'<string>'
]
]
],
'min_spans' => 1,
'max_spans' => 1,
'min_duration_ms' => 1,
'max_duration_ms' => 1,
'min_tokens' => 1,
'min_thread_traces' => 2,
'max_thread_traces' => 2
],
'limit' => 50,
'cursor' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.uselemma.ai/traces/query"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"match\": {\n \"kind\": \"none\",\n \"fields\": []\n },\n \"start_inclusive\": \"2023-11-07T05:31:56Z\",\n \"end_exclusive\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"agent_name\": \"<string>\",\n \"has_error\": true,\n \"has_issues\": true,\n \"tool\": {\n \"name\": null\n },\n \"model\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attribute_filters\": [\n {\n \"path\": \"<string>\",\n \"op\": \"<string>\",\n \"value\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"min_spans\": 1,\n \"max_spans\": 1,\n \"min_duration_ms\": 1,\n \"max_duration_ms\": 1,\n \"min_tokens\": 1,\n \"min_thread_traces\": 2,\n \"max_thread_traces\": 2\n },\n \"limit\": 50,\n \"cursor\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.uselemma.ai/traces/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"match\": {\n \"kind\": \"none\",\n \"fields\": []\n },\n \"start_inclusive\": \"2023-11-07T05:31:56Z\",\n \"end_exclusive\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"agent_name\": \"<string>\",\n \"has_error\": true,\n \"has_issues\": true,\n \"tool\": {\n \"name\": null\n },\n \"model\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attribute_filters\": [\n {\n \"path\": \"<string>\",\n \"op\": \"<string>\",\n \"value\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"min_spans\": 1,\n \"max_spans\": 1,\n \"min_duration_ms\": 1,\n \"max_duration_ms\": 1,\n \"min_tokens\": 1,\n \"min_thread_traces\": 2,\n \"max_thread_traces\": 2\n },\n \"limit\": 50,\n \"cursor\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselemma.ai/traces/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"match\": {\n \"kind\": \"none\",\n \"fields\": []\n },\n \"start_inclusive\": \"2023-11-07T05:31:56Z\",\n \"end_exclusive\": \"2023-11-07T05:31:56Z\",\n \"filters\": {\n \"agent_name\": \"<string>\",\n \"has_error\": true,\n \"has_issues\": true,\n \"tool\": {\n \"name\": null\n },\n \"model\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attribute_filters\": [\n {\n \"path\": \"<string>\",\n \"op\": \"<string>\",\n \"value\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"min_spans\": 1,\n \"max_spans\": 1,\n \"min_duration_ms\": 1,\n \"max_duration_ms\": 1,\n \"min_tokens\": 1,\n \"min_thread_traces\": 2,\n \"max_thread_traces\": 2\n },\n \"limit\": 50,\n \"cursor\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"traces": [
{
"id": "<string>",
"otel_trace_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"agent_name": "<string>",
"thread_id": "<string>",
"total_duration_ms": 123,
"span_count": 1,
"has_error": true,
"score": 123,
"matching_spans": [
{
"match_id": "<string>",
"span_id": "<string>",
"span_name": "<string>",
"field": "<string>",
"attribute_path": "<string>",
"snippet": "<string>",
"rank": 123,
"span": {
"kind": "<string>",
"status_code": "<string>",
"attributes": {}
}
}
],
"root_span": {
"attributes": {},
"attributes_truncated": true
}
}
],
"next_request": {
"operation": "<string>",
"arguments": {
"project_id": "<string>",
"match": {
"kind": "none",
"fields": [
"otel_trace_id"
],
"sort": "timestamp_desc"
},
"start_inclusive": "2023-11-07T05:31:56Z",
"end_exclusive": "2023-11-07T05:31:56Z",
"filters": {
"agent_name": "<string>",
"has_error": true,
"has_issues": true,
"tool": {
"name": null
},
"model": "<string>",
"thread_id": "<string>",
"attribute_filters": [
{
"path": "<string>",
"op": "<string>",
"value": "<string>",
"values": [
"<string>"
]
}
],
"min_spans": 1,
"max_spans": 1,
"min_duration_ms": 1,
"max_duration_ms": 1,
"min_tokens": 1,
"min_thread_traces": 2,
"max_thread_traces": 2
},
"limit": 50,
"cursor": "<string>"
}
}
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}Authorizations
Body
application/json