Traces
Get trace details
Optimization Studio
Monitoring Integration
- Overview
- Python
- TypeScript
- OpenTelemetry
- Langflow Integration
- Flowise Integration
- REST API Integration
- RAG Context Tracking
- Concepts
- Cookbooks
Evaluations
Guardrails
User Events
- Overview
- Events
DSPy Visualization
More Features
API Endpoints
Traces
Get trace details
Returns single trace details based on the ID supplied
GET
/
api
/
trace
/
{id}
curl --request GET \
--url https://app.langwatch.ai/api/trace/{id} \
--header 'X-Auth-Token: <api-key>'
{
"trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
"project_id": "KAXYxPR8MUgTcP8CF193y",
"metadata": {
"sdk_version": "0.1.11",
"sdk_language": "python"
},
"timestamps": {
"started_at": 1721382486868,
"inserted_at": 1721382492894,
"updated_at": 1721382492894
},
"input": {
"value": "hi"
},
"output": {
"value": "Hey there! 👋😊"
},
"metrics": {
"first_token_ms": 1449,
"total_time_ms": 1543,
"prompt_tokens": 20,
"completion_tokens": 7,
"tokens_estimated": true
},
"error": null,
"indexing_md5s": [
"cccd21e0b70c706034dfd9f7772816a3"
],
"spans": [
{
"trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
"span_id": "span_h1xUkcUJilhudDrLeQbR_",
"timestamps": {
"finished_at": 1721382488392,
"updated_at": 1721382492027,
"started_at": 1721382486895,
"first_token_at": 1721382488317,
"inserted_at": 1721382492027
},
"type": "llm",
"error": null,
"params": {
"stream": true,
"temperature": 1
},
"project_id": "KAXYxPR8MUgTcP8CF193y",
"parent_id": "span_ijZNjUMTz3ys0Z0YKwF_T",
"name": null,
"model": "openai/gpt-4o",
"metrics": {
"tokens_estimated": true,
"completion_tokens": 7,
"prompt_tokens": 20
},
"input": {
"type": "chat_messages",
"value": [
{
"role": "system",
"content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis."
},
{
"role": "user",
"content": "hi"
}
]
},
"output": {
"type": "chat_messages",
"value": [
{
"role": "assistant",
"content": "Hey there! 👋😊"
}
]
}
}
],
"evaluations": [
{
"evaluation_id": "check_VCagriZHNWICSOM09dXjM",
"name": "Ragas Answer Relevancy",
"type": "ragas/answer_relevancy",
"trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
"project_id": "KAXYxPR8MUgTcP8CF193y",
"status": "error",
"timestamps": {
"updated_at": 1721383657788,
"inserted_at": 1721382493358
},
"error": {
"stacktrace": [
"TypeError: fetch failed"
],
"message": "fetch failed",
"has_error": true
}
}
]
}
Authorizations
Path Parameters
ID of trace to share
Response
200
application/json
Trace details with spans and evaluations
curl --request GET \
--url https://app.langwatch.ai/api/trace/{id} \
--header 'X-Auth-Token: <api-key>'
{
"trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
"project_id": "KAXYxPR8MUgTcP8CF193y",
"metadata": {
"sdk_version": "0.1.11",
"sdk_language": "python"
},
"timestamps": {
"started_at": 1721382486868,
"inserted_at": 1721382492894,
"updated_at": 1721382492894
},
"input": {
"value": "hi"
},
"output": {
"value": "Hey there! 👋😊"
},
"metrics": {
"first_token_ms": 1449,
"total_time_ms": 1543,
"prompt_tokens": 20,
"completion_tokens": 7,
"tokens_estimated": true
},
"error": null,
"indexing_md5s": [
"cccd21e0b70c706034dfd9f7772816a3"
],
"spans": [
{
"trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
"span_id": "span_h1xUkcUJilhudDrLeQbR_",
"timestamps": {
"finished_at": 1721382488392,
"updated_at": 1721382492027,
"started_at": 1721382486895,
"first_token_at": 1721382488317,
"inserted_at": 1721382492027
},
"type": "llm",
"error": null,
"params": {
"stream": true,
"temperature": 1
},
"project_id": "KAXYxPR8MUgTcP8CF193y",
"parent_id": "span_ijZNjUMTz3ys0Z0YKwF_T",
"name": null,
"model": "openai/gpt-4o",
"metrics": {
"tokens_estimated": true,
"completion_tokens": 7,
"prompt_tokens": 20
},
"input": {
"type": "chat_messages",
"value": [
{
"role": "system",
"content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis."
},
{
"role": "user",
"content": "hi"
}
]
},
"output": {
"type": "chat_messages",
"value": [
{
"role": "assistant",
"content": "Hey there! 👋😊"
}
]
}
}
],
"evaluations": [
{
"evaluation_id": "check_VCagriZHNWICSOM09dXjM",
"name": "Ragas Answer Relevancy",
"type": "ragas/answer_relevancy",
"trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
"project_id": "KAXYxPR8MUgTcP8CF193y",
"status": "error",
"timestamps": {
"updated_at": 1721383657788,
"inserted_at": 1721382493358
},
"error": {
"stacktrace": [
"TypeError: fetch failed"
],
"message": "fetch failed",
"has_error": true
}
}
]
}