Skip to content
Ona Docs

GetAgentTraceSummary

usage.get_agent_trace_summary(UsageGetAgentTraceSummaryParams**kwargs) -> UsageGetAgentTraceSummaryResponse
POST/gitpod.v1.UsageService/GetAgentTraceSummary

Gets aggregated agent trace summary for the organization or a specific project.

Use this method to:

  • Measure agent sessions and line changes
  • Break down agent activity by model
  • Scope agent trace insights to a project, user, or team

Example

dateRange:
  startTime: "2024-01-01T00:00:00Z"
  endTime: "2024-02-01T00:00:00Z"
projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
ParametersExpand Collapse
date_range: DateRange

Date range to query within.

end_time: datetime

End time of the date range (exclusive).

formatdate-time
start_time: datetime

Start time of the date range (inclusive).

formatdate-time
project_id: Optional[str]

Optional project ID to scope results.

team_id: Optional[str]

Optional team ID to scope results to a specific team. Mutually exclusive with user_id.

user_id: Optional[str]

Optional user ID to scope results to a specific user. Mutually exclusive with team_id.

ReturnsExpand Collapse
class UsageGetAgentTraceSummaryResponse:
sparkline: Optional[List[TimeSeriesPoint]]

Sparkline data for card rendering.

time: Optional[datetime]

Timestamp for this data point.

formatdate-time
value: Optional[int]

The numerical value for this data point.

formatint32
summary: Optional[AgentTraceSummary]

Summary totals and trends for the requested date range.

by_model: Optional[List[AgentTraceModelBreakdown]]

Per-model breakdown of session stats.

lines_added: Optional[str]

Lines added by sessions using this model.

lines_removed: Optional[str]

Lines removed by sessions using this model.

model: Optional[SupportedModel]

The model these stats are for.

One of the following:
"SUPPORTED_MODEL_UNSPECIFIED"
"SUPPORTED_MODEL_SONNET_3_5"
"SUPPORTED_MODEL_SONNET_3_7"
"SUPPORTED_MODEL_SONNET_3_7_EXTENDED"
"SUPPORTED_MODEL_SONNET_4"
"SUPPORTED_MODEL_SONNET_4_EXTENDED"
"SUPPORTED_MODEL_SONNET_4_5"
"SUPPORTED_MODEL_SONNET_4_5_EXTENDED"
"SUPPORTED_MODEL_SONNET_4_6"
"SUPPORTED_MODEL_SONNET_4_6_EXTENDED"
"SUPPORTED_MODEL_SONNET_5"
"SUPPORTED_MODEL_OPUS_4"
"SUPPORTED_MODEL_OPUS_4_EXTENDED"
"SUPPORTED_MODEL_OPUS_4_5"
"SUPPORTED_MODEL_OPUS_4_5_EXTENDED"
"SUPPORTED_MODEL_OPUS_4_6"
"SUPPORTED_MODEL_OPUS_4_6_EXTENDED"
"SUPPORTED_MODEL_OPUS_4_7"
"SUPPORTED_MODEL_OPUS_4_8"
"SUPPORTED_MODEL_HAIKU_4_5"
"SUPPORTED_MODEL_OPENAI_4O"
"SUPPORTED_MODEL_OPENAI_4O_MINI"
"SUPPORTED_MODEL_OPENAI_O1"
"SUPPORTED_MODEL_OPENAI_O1_MINI"
"SUPPORTED_MODEL_OPENAI_AUTO"
sessions: Optional[str]

Number of sessions that used this model.

total_lines_added: Optional[str]

Total lines added across all sessions.

total_lines_added_trend: Optional[float]

Fractional change in total_lines_added compared to the previous period.

formatdouble
total_lines_removed: Optional[str]

Total lines removed across all sessions.

total_lines_removed_trend: Optional[float]

Fractional change in total_lines_removed compared to the previous period.

formatdouble
total_sessions: Optional[str]

Total number of agent trace sessions in the date range.

total_sessions_trend: Optional[float]

Fractional change in total_sessions compared to the previous period of equal length. Computed as (current - previous) / previous. Zero when there is no previous data.

formatdouble

GetAgentTraceSummary

import os
from datetime import datetime
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
response = client.usage.get_agent_trace_summary(
    date_range={
        "end_time": datetime.fromisoformat("2024-02-01T00:00:00"),
        "start_time": datetime.fromisoformat("2024-01-01T00:00:00"),
    },
    project_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
)
print(response.sparkline)
{
  "sparkline": [
    {
      "time": "2019-12-27T18:11:19.117Z",
      "value": 0
    }
  ],
  "summary": {
    "byModel": [
      {
        "linesAdded": "linesAdded",
        "linesRemoved": "linesRemoved",
        "model": "SUPPORTED_MODEL_UNSPECIFIED",
        "sessions": "sessions"
      }
    ],
    "totalLinesAdded": "totalLinesAdded",
    "totalLinesAddedTrend": 0,
    "totalLinesRemoved": "totalLinesRemoved",
    "totalLinesRemovedTrend": 0,
    "totalSessions": "totalSessions",
    "totalSessionsTrend": 0
  }
}
Returns Examples
{
  "sparkline": [
    {
      "time": "2019-12-27T18:11:19.117Z",
      "value": 0
    }
  ],
  "summary": {
    "byModel": [
      {
        "linesAdded": "linesAdded",
        "linesRemoved": "linesRemoved",
        "model": "SUPPORTED_MODEL_UNSPECIFIED",
        "sessions": "sessions"
      }
    ],
    "totalLinesAdded": "totalLinesAdded",
    "totalLinesAddedTrend": 0,
    "totalLinesRemoved": "totalLinesRemoved",
    "totalLinesRemovedTrend": 0,
    "totalSessions": "totalSessions",
    "totalSessionsTrend": 0
  }
}