import requests
url = "https://app.langwatch.ai/api/coding-agent/sessions/{sessionId}/events"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/coding-agent/sessions/{sessionId}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/coding-agent/sessions/{sessionId}/events \
--header 'X-Auth-Token: <api-key>'{
"events": [
{
"sessionId": "<string>",
"timeUnixMs": 123,
"recordId": "<string>",
"eventKind": "<string>",
"agent": "<string>",
"sessionKeySource": "<string>",
"traceId": "<string>",
"spanId": "<string>",
"promptId": "<string>",
"querySource": "<string>",
"agentType": "<string>",
"eventSequence": 123,
"requestId": "<string>",
"model": "<string>",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadTokens": 123,
"cacheCreationTokens": 123,
"costUsd": 123,
"durationMs": 123,
"ttftMs": 123,
"attempt": 123,
"speed": "<string>",
"stopReason": "<string>",
"preTokens": 123,
"postTokens": 123,
"compactionTrigger": "<string>",
"precomputeReuse": "<string>",
"statusCode": "<string>",
"errorType": "<string>",
"rateLimitCarrier": "<string>",
"retryDurationMs": 123,
"toolName": "<string>",
"success": "<string>",
"decision": "<string>",
"decisionSource": "<string>",
"toolInputBytes": 123,
"toolResultBytes": 123,
"promptChars": 123,
"totalTokens": 123
}
],
"nextCursor": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}List coding agent session events
List a coding-agent session’s events (model calls, compactions, rate limits, tool runs, prompts) in time order, keyset-paginated. Pass the previous response’s nextCursor to continue; filter with kinds (comma-separated).
import requests
url = "https://app.langwatch.ai/api/coding-agent/sessions/{sessionId}/events"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/coding-agent/sessions/{sessionId}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/coding-agent/sessions/{sessionId}/events \
--header 'X-Auth-Token: <api-key>'{
"events": [
{
"sessionId": "<string>",
"timeUnixMs": 123,
"recordId": "<string>",
"eventKind": "<string>",
"agent": "<string>",
"sessionKeySource": "<string>",
"traceId": "<string>",
"spanId": "<string>",
"promptId": "<string>",
"querySource": "<string>",
"agentType": "<string>",
"eventSequence": 123,
"requestId": "<string>",
"model": "<string>",
"inputTokens": 123,
"outputTokens": 123,
"cacheReadTokens": 123,
"cacheCreationTokens": 123,
"costUsd": 123,
"durationMs": 123,
"ttftMs": 123,
"attempt": 123,
"speed": "<string>",
"stopReason": "<string>",
"preTokens": 123,
"postTokens": 123,
"compactionTrigger": "<string>",
"precomputeReuse": "<string>",
"statusCode": "<string>",
"errorType": "<string>",
"rateLimitCarrier": "<string>",
"retryDurationMs": 123,
"toolName": "<string>",
"success": "<string>",
"decision": "<string>",
"decisionSource": "<string>",
"toolInputBytes": 123,
"toolResultBytes": 123,
"promptChars": 123,
"totalTokens": 123
}
],
"nextCursor": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Path Parameters
The agent's own session id (session.id / conversation id).
Query Parameters
Comma-separated event kinds to include. Known kinds: model_call, compaction, rate_limit, api_error, retries_exhausted, tool_result, tool_decision, user_prompt, subagent_completed.
Opaque keyset cursor from the previous response's nextCursor.
x <= 1000Epoch ms lower bound on event time; with to, prunes storage partitions for faster reads.
Epoch ms upper bound on event time.
Was this page helpful?