GenAI Spansクエリ
curl --request POST \
--url https://api.example.com/agents/spans/query \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"custom_attr_columns": [
{
"key": "<string>",
"source": "field"
}
],
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"group_distributions": [
{
"alias": "<string>",
"value": {
"key": "<string>",
"source": "field"
},
"bins": 12,
"top_n": 5
}
],
"group_filters": [
{
"measure": {
"alias": "<string>",
"filter": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"value": {
"key": "<string>",
"source": "field"
}
},
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"max": 123,
"min": 123
}
],
"include_details": false,
"limit": 100,
"measures": [
{
"alias": "<string>",
"filter": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"value": {
"key": "<string>",
"source": "field"
}
}
],
"offset": 0,
"query": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"sort_by": [
{
"field": "<string>",
"direction": "desc"
}
],
"started_after": "2023-11-07T05:31:56Z",
"started_before": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.example.com/agents/spans/query"
payload = {
"project_id": "<string>",
"custom_attr_columns": [
{
"key": "<string>",
"source": "field"
}
],
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"group_distributions": [
{
"alias": "<string>",
"value": {
"key": "<string>",
"source": "field"
},
"bins": 12,
"top_n": 5
}
],
"group_filters": [
{
"measure": {
"alias": "<string>",
"filter": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"value": {
"key": "<string>",
"source": "field"
}
},
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"max": 123,
"min": 123
}
],
"include_details": False,
"limit": 100,
"measures": [
{
"alias": "<string>",
"filter": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"value": {
"key": "<string>",
"source": "field"
}
}
],
"offset": 0,
"query": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"sort_by": [
{
"field": "<string>",
"direction": "desc"
}
],
"started_after": "2023-11-07T05:31:56Z",
"started_before": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
custom_attr_columns: [{key: '<string>', source: 'field'}],
group_by: [{key: '<string>', alias: '<string>', source: 'field'}],
group_distributions: [
{
alias: '<string>',
value: {key: '<string>', source: 'field'},
bins: 12,
top_n: 5
}
],
group_filters: [
{
measure: {
alias: '<string>',
filter: {$expr: {$and: [{$literal: '<string>'}]}},
value: {key: '<string>', source: 'field'}
},
group_by: [{key: '<string>', alias: '<string>', source: 'field'}],
max: 123,
min: 123
}
],
include_details: false,
limit: 100,
measures: [
{
alias: '<string>',
filter: {$expr: {$and: [{$literal: '<string>'}]}},
value: {key: '<string>', source: 'field'}
}
],
offset: 0,
query: {$expr: {$and: [{$literal: '<string>'}]}},
sort_by: [{field: '<string>', direction: 'desc'}],
started_after: '2023-11-07T05:31:56Z',
started_before: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.example.com/agents/spans/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.example.com/agents/spans/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>',
'custom_attr_columns' => [
[
'key' => '<string>',
'source' => 'field'
]
],
'group_by' => [
[
'key' => '<string>',
'alias' => '<string>',
'source' => 'field'
]
],
'group_distributions' => [
[
'alias' => '<string>',
'value' => [
'key' => '<string>',
'source' => 'field'
],
'bins' => 12,
'top_n' => 5
]
],
'group_filters' => [
[
'measure' => [
'alias' => '<string>',
'filter' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'value' => [
'key' => '<string>',
'source' => 'field'
]
],
'group_by' => [
[
'key' => '<string>',
'alias' => '<string>',
'source' => 'field'
]
],
'max' => 123,
'min' => 123
]
],
'include_details' => false,
'limit' => 100,
'measures' => [
[
'alias' => '<string>',
'filter' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'value' => [
'key' => '<string>',
'source' => 'field'
]
]
],
'offset' => 0,
'query' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'sort_by' => [
[
'field' => '<string>',
'direction' => 'desc'
]
],
'started_after' => '2023-11-07T05:31:56Z',
'started_before' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.example.com/agents/spans/query"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"custom_attr_columns\": [\n {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_distributions\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"bins\": 12,\n \"top_n\": 5\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"include_details\": false,\n \"limit\": 100,\n \"measures\": [\n {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n }\n ],\n \"offset\": 0,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"sort_by\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"desc\"\n }\n ],\n \"started_after\": \"2023-11-07T05:31:56Z\",\n \"started_before\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.example.com/agents/spans/query")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"custom_attr_columns\": [\n {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_distributions\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"bins\": 12,\n \"top_n\": 5\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"include_details\": false,\n \"limit\": 100,\n \"measures\": [\n {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n }\n ],\n \"offset\": 0,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"sort_by\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"desc\"\n }\n ],\n \"started_after\": \"2023-11-07T05:31:56Z\",\n \"started_before\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/agents/spans/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"custom_attr_columns\": [\n {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_distributions\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"bins\": 12,\n \"top_n\": 5\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"include_details\": false,\n \"limit\": 100,\n \"measures\": [\n {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n }\n ],\n \"offset\": 0,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"sort_by\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"desc\"\n }\n ],\n \"started_after\": \"2023-11-07T05:31:56Z\",\n \"started_before\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"groups": [
{
"agent_names": [
"<string>"
],
"agent_versions": [
"<string>"
],
"conversation_count": 0,
"conversation_names": [
"<string>"
],
"distributions": {},
"error_count": 0,
"first_message": {
"role": "",
"text": ""
},
"first_seen": "2023-11-07T05:31:56Z",
"group_keys": {},
"invocation_count": 0,
"last_message": {
"role": "",
"text": ""
},
"last_seen": "2023-11-07T05:31:56Z",
"metrics": {},
"provider_names": [
"<string>"
],
"request_models": [
"<string>"
],
"span_count": 0,
"total_cache_creation_input_tokens": 0,
"total_cache_read_input_tokens": 0,
"total_duration_ms": 0,
"total_input_tokens": 0,
"total_output_tokens": 0,
"total_reasoning_tokens": 0
}
],
"spans": [
{
"project_id": "<string>",
"span_id": "<string>",
"trace_id": "<string>",
"agent_description": "<string>",
"agent_id": "<string>",
"agent_name": "<string>",
"agent_version": "<string>",
"artifact_refs": [
"<string>"
],
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123,
"compaction_items_after": 123,
"compaction_items_before": 123,
"compaction_summary": "<string>",
"content_refs": [
"<string>"
],
"conversation_id": "<string>",
"conversation_name": "<string>",
"custom_attrs_bool": {},
"custom_attrs_float": {},
"custom_attrs_int": {},
"custom_attrs_string": {},
"ended_at": "2023-11-07T05:31:56Z",
"error_type": "<string>",
"finish_reasons": [
"<string>"
],
"input_messages": [
{
"content": "<string>",
"finish_reason": "",
"role": ""
}
],
"input_tokens": 123,
"object_refs": [
"<string>"
],
"operation_name": "<string>",
"output_messages": [
{
"content": "<string>",
"finish_reason": "",
"role": ""
}
],
"output_tokens": 123,
"output_type": "<string>",
"parent_span_id": "<string>",
"provider_name": "<string>",
"raw_span_dump": "<string>",
"reasoning_content": "<string>",
"reasoning_tokens": 123,
"request_choice_count": 123,
"request_frequency_penalty": 123,
"request_max_tokens": 123,
"request_model": "<string>",
"request_presence_penalty": 123,
"request_seed": 123,
"request_stop_sequences": [
"<string>"
],
"request_temperature": 123,
"request_top_p": 123,
"response_id": "<string>",
"response_model": "<string>",
"server_address": "<string>",
"server_port": 123,
"span_name": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"status_message": "<string>",
"system_instructions": [
"<string>"
],
"tool_call_arguments": "<string>",
"tool_call_id": "<string>",
"tool_call_result": "<string>",
"tool_definitions": "<string>",
"tool_description": "<string>",
"tool_name": "<string>",
"tool_type": "<string>",
"wb_run_id": "<string>",
"wb_run_step": 123,
"wb_run_step_end": 123,
"wb_user_id": "<string>"
}
],
"total_count": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}エージェントのスパンを、生の行またはグループ化された集約としてクエリします。
POST
/
agents
/
spans
/
query
GenAI Spansクエリ
curl --request POST \
--url https://api.example.com/agents/spans/query \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"custom_attr_columns": [
{
"key": "<string>",
"source": "field"
}
],
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"group_distributions": [
{
"alias": "<string>",
"value": {
"key": "<string>",
"source": "field"
},
"bins": 12,
"top_n": 5
}
],
"group_filters": [
{
"measure": {
"alias": "<string>",
"filter": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"value": {
"key": "<string>",
"source": "field"
}
},
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"max": 123,
"min": 123
}
],
"include_details": false,
"limit": 100,
"measures": [
{
"alias": "<string>",
"filter": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"value": {
"key": "<string>",
"source": "field"
}
}
],
"offset": 0,
"query": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"sort_by": [
{
"field": "<string>",
"direction": "desc"
}
],
"started_after": "2023-11-07T05:31:56Z",
"started_before": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.example.com/agents/spans/query"
payload = {
"project_id": "<string>",
"custom_attr_columns": [
{
"key": "<string>",
"source": "field"
}
],
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"group_distributions": [
{
"alias": "<string>",
"value": {
"key": "<string>",
"source": "field"
},
"bins": 12,
"top_n": 5
}
],
"group_filters": [
{
"measure": {
"alias": "<string>",
"filter": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"value": {
"key": "<string>",
"source": "field"
}
},
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"max": 123,
"min": 123
}
],
"include_details": False,
"limit": 100,
"measures": [
{
"alias": "<string>",
"filter": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"value": {
"key": "<string>",
"source": "field"
}
}
],
"offset": 0,
"query": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"sort_by": [
{
"field": "<string>",
"direction": "desc"
}
],
"started_after": "2023-11-07T05:31:56Z",
"started_before": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
custom_attr_columns: [{key: '<string>', source: 'field'}],
group_by: [{key: '<string>', alias: '<string>', source: 'field'}],
group_distributions: [
{
alias: '<string>',
value: {key: '<string>', source: 'field'},
bins: 12,
top_n: 5
}
],
group_filters: [
{
measure: {
alias: '<string>',
filter: {$expr: {$and: [{$literal: '<string>'}]}},
value: {key: '<string>', source: 'field'}
},
group_by: [{key: '<string>', alias: '<string>', source: 'field'}],
max: 123,
min: 123
}
],
include_details: false,
limit: 100,
measures: [
{
alias: '<string>',
filter: {$expr: {$and: [{$literal: '<string>'}]}},
value: {key: '<string>', source: 'field'}
}
],
offset: 0,
query: {$expr: {$and: [{$literal: '<string>'}]}},
sort_by: [{field: '<string>', direction: 'desc'}],
started_after: '2023-11-07T05:31:56Z',
started_before: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.example.com/agents/spans/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.example.com/agents/spans/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>',
'custom_attr_columns' => [
[
'key' => '<string>',
'source' => 'field'
]
],
'group_by' => [
[
'key' => '<string>',
'alias' => '<string>',
'source' => 'field'
]
],
'group_distributions' => [
[
'alias' => '<string>',
'value' => [
'key' => '<string>',
'source' => 'field'
],
'bins' => 12,
'top_n' => 5
]
],
'group_filters' => [
[
'measure' => [
'alias' => '<string>',
'filter' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'value' => [
'key' => '<string>',
'source' => 'field'
]
],
'group_by' => [
[
'key' => '<string>',
'alias' => '<string>',
'source' => 'field'
]
],
'max' => 123,
'min' => 123
]
],
'include_details' => false,
'limit' => 100,
'measures' => [
[
'alias' => '<string>',
'filter' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'value' => [
'key' => '<string>',
'source' => 'field'
]
]
],
'offset' => 0,
'query' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'sort_by' => [
[
'field' => '<string>',
'direction' => 'desc'
]
],
'started_after' => '2023-11-07T05:31:56Z',
'started_before' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.example.com/agents/spans/query"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"custom_attr_columns\": [\n {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_distributions\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"bins\": 12,\n \"top_n\": 5\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"include_details\": false,\n \"limit\": 100,\n \"measures\": [\n {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n }\n ],\n \"offset\": 0,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"sort_by\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"desc\"\n }\n ],\n \"started_after\": \"2023-11-07T05:31:56Z\",\n \"started_before\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.example.com/agents/spans/query")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"custom_attr_columns\": [\n {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_distributions\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"bins\": 12,\n \"top_n\": 5\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"include_details\": false,\n \"limit\": 100,\n \"measures\": [\n {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n }\n ],\n \"offset\": 0,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"sort_by\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"desc\"\n }\n ],\n \"started_after\": \"2023-11-07T05:31:56Z\",\n \"started_before\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/agents/spans/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"custom_attr_columns\": [\n {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_distributions\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"bins\": 12,\n \"top_n\": 5\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"include_details\": false,\n \"limit\": 100,\n \"measures\": [\n {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n }\n ],\n \"offset\": 0,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"sort_by\": [\n {\n \"field\": \"<string>\",\n \"direction\": \"desc\"\n }\n ],\n \"started_after\": \"2023-11-07T05:31:56Z\",\n \"started_before\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"groups": [
{
"agent_names": [
"<string>"
],
"agent_versions": [
"<string>"
],
"conversation_count": 0,
"conversation_names": [
"<string>"
],
"distributions": {},
"error_count": 0,
"first_message": {
"role": "",
"text": ""
},
"first_seen": "2023-11-07T05:31:56Z",
"group_keys": {},
"invocation_count": 0,
"last_message": {
"role": "",
"text": ""
},
"last_seen": "2023-11-07T05:31:56Z",
"metrics": {},
"provider_names": [
"<string>"
],
"request_models": [
"<string>"
],
"span_count": 0,
"total_cache_creation_input_tokens": 0,
"total_cache_read_input_tokens": 0,
"total_duration_ms": 0,
"total_input_tokens": 0,
"total_output_tokens": 0,
"total_reasoning_tokens": 0
}
],
"spans": [
{
"project_id": "<string>",
"span_id": "<string>",
"trace_id": "<string>",
"agent_description": "<string>",
"agent_id": "<string>",
"agent_name": "<string>",
"agent_version": "<string>",
"artifact_refs": [
"<string>"
],
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123,
"compaction_items_after": 123,
"compaction_items_before": 123,
"compaction_summary": "<string>",
"content_refs": [
"<string>"
],
"conversation_id": "<string>",
"conversation_name": "<string>",
"custom_attrs_bool": {},
"custom_attrs_float": {},
"custom_attrs_int": {},
"custom_attrs_string": {},
"ended_at": "2023-11-07T05:31:56Z",
"error_type": "<string>",
"finish_reasons": [
"<string>"
],
"input_messages": [
{
"content": "<string>",
"finish_reason": "",
"role": ""
}
],
"input_tokens": 123,
"object_refs": [
"<string>"
],
"operation_name": "<string>",
"output_messages": [
{
"content": "<string>",
"finish_reason": "",
"role": ""
}
],
"output_tokens": 123,
"output_type": "<string>",
"parent_span_id": "<string>",
"provider_name": "<string>",
"raw_span_dump": "<string>",
"reasoning_content": "<string>",
"reasoning_tokens": 123,
"request_choice_count": 123,
"request_frequency_penalty": 123,
"request_max_tokens": 123,
"request_model": "<string>",
"request_presence_penalty": 123,
"request_seed": 123,
"request_stop_sequences": [
"<string>"
],
"request_temperature": 123,
"request_top_p": 123,
"response_id": "<string>",
"response_model": "<string>",
"server_address": "<string>",
"server_port": 123,
"span_name": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"status_message": "<string>",
"system_instructions": [
"<string>"
],
"tool_call_arguments": "<string>",
"tool_call_id": "<string>",
"tool_call_result": "<string>",
"tool_definitions": "<string>",
"tool_description": "<string>",
"tool_name": "<string>",
"tool_type": "<string>",
"wb_run_id": "<string>",
"wb_run_step": 123,
"wb_run_step_end": 123,
"wb_user_id": "<string>"
}
],
"total_count": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}承認
HTTPBasicHTTPBearer
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
ボディ
application/json
project のエージェント スパンをクエリするためのリクエストです。
group_by が空(または省略されている)場合は、生のスパン行をレスポンスの spans フィールドで返します。group_by が空でない場合は、集約されたグループ行をレスポンスの groups フィールドで返します。
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Maximum array length:
20Show child attributes
Show child attributes
Show child attributes
Show child attributes
必須範囲:
0 <= x <= 10000Show child attributes
Show child attributes
必須範囲:
x >= 0Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I