> ## Documentation Index
> Fetch the complete documentation index at: https://ona.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Agent Trace Summary

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

`Unary` · [`Usage`](/docs/api-reference/generated/usage/overview)

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

```yaml theme={null}
dateRange:
  startTime: "2024-01-01T00:00:00Z"
  endTime: "2024-02-01T00:00:00Z"
projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.UsageService/GetAgentTraceSummary
```

Send a Bearer token as described in [Authentication](/docs/api-reference#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

<CodeGroup>
  ```bash cURL theme={null}
  export ONA_HOST=https://app.ona.com
  export ONA_API_KEY=<your-token>

  curl --request POST \
    --url "$ONA_HOST/api/gitpod.v1.UsageService/GetAgentTraceSummary" \
    --header "Authorization: Bearer $ONA_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
    "dateRange": {
      "endTime": "2026-01-01T00:00:00Z",
      "startTime": "2026-01-01T00:00:00Z"
    }
  }'
  ```

  ```python Python theme={null}
  import gitpod.v1.usage_pb2 as usage_pb2
  import google.protobuf.timestamp_pb2 as timestamp_pb2
  from ona_sdk import create_client_from_env

  ona = create_client_from_env()
  request = usage_pb2.GetAgentTraceSummaryRequest(
      date_range=usage_pb2.DateRange(
          start_time=timestamp_pb2.Timestamp(seconds=1767225600),
          end_time=timestamp_pb2.Timestamp(seconds=1767225600),
      ),
  )
  response = ona.services.usage.get_agent_trace_summary(request)
  print(response)
  ```

  ```typescript TypeScript theme={null}
  import { create } from "@bufbuild/protobuf";
  import { createClientFromEnv } from "@gitpod/sdk";
  import { GetAgentTraceSummaryRequestSchema } from "@gitpod/sdk/gitpod/v1/usage_pb";
  import { timestampFromDate } from "@bufbuild/protobuf/wkt";

  async function main() {
    const ona = createClientFromEnv();
    const request = create(GetAgentTraceSummaryRequestSchema, {
      dateRange: {
        startTime: timestampFromDate(new Date("2026-01-01T00:00:00Z")),
        endTime: timestampFromDate(new Date("2026-01-01T00:00:00Z")),
      },
    });
    const response = await ona.services.usage.getAgentTraceSummary(request);
    console.log(response);
  }

  main().catch(console.error);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	"connectrpc.com/connect"
  	"github.com/gitpod-io/gitpod-sdk-go/sdk"
  	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
  )

  func main() {
  	ona, err := sdk.NewFromEnv()
  	if err != nil {
  		log.Fatal(err)
  	}

  	request := connect.NewRequest(&gitpodpb.GetAgentTraceSummaryRequest{
  		DateRange: &gitpodpb.DateRange{
  			StartTime: &timestamppb.Timestamp{Seconds: 1767225600},
  			EndTime: &timestamppb.Timestamp{Seconds: 1767225600},
  		},
  	})
  	response, err := ona.Services.Usage.GetAgentTraceSummary(context.Background(), request)
  	if err != nil {
  		log.Fatal(err)
  	}
  	fmt.Println(response.Msg)
  }
  ```

  ```json Request body theme={null}
  {
    "dateRange": {
      "endTime": "2026-01-01T00:00:00Z",
      "startTime": "2026-01-01T00:00:00Z"
    }
  }
  ```
</CodeGroup>

## Request

`gitpod.v1.GetAgentTraceSummaryRequest`

| Field       | Type                                    | Required | Description                                                                             |
| ----------- | --------------------------------------- | -------- | --------------------------------------------------------------------------------------- |
| `dateRange` | [DateRange](#type-gitpod-v1-date-range) | Yes      | Date range to query within. Constraints: `required=true`.                               |
| `projectId` | string                                  | No       | Optional project ID to scope results.                                                   |
| `userId`    | string                                  | No       | Optional user ID to scope results to a specific user. Mutually exclusive with team\_id. |
| `teamId`    | string                                  | No       | Optional team ID to scope results to a specific team. Mutually exclusive with user\_id. |

## Response

`gitpod.v1.GetAgentTraceSummaryResponse`

| Field       | Type                                                          | Required | Description                                             |
| ----------- | ------------------------------------------------------------- | -------- | ------------------------------------------------------- |
| `summary`   | [AgentTraceSummary](#type-gitpod-v1-agent-trace-summary)      | No       | Summary totals and trends for the requested date range. |
| `sparkline` | array of [TimeSeriesPoint](#type-gitpod-v1-time-series-point) | No       | Sparkline data for card rendering.                      |

## Related types

<a id="type-gitpod-v1-agent-trace-model-breakdown" />

<Accordion title="AgentTraceModelBreakdown">
  AgentTraceModelBreakdown contains stats for a single LLM model.

  `gitpod.v1.AgentTraceModelBreakdown`

  | Field          | Type                                              | Required | Description                                 |
  | -------------- | ------------------------------------------------- | -------- | ------------------------------------------- |
  | `model`        | [SupportedModel](#enum-gitpod-v1-supported-model) | No       | The model these stats are for.              |
  | `sessions`     | 64-bit integer string                             | No       | Number of sessions that used this model.    |
  | `linesAdded`   | 64-bit integer string                             | No       | Lines added by sessions using this model.   |
  | `linesRemoved` | 64-bit integer string                             | No       | Lines removed by sessions using this model. |
</Accordion>

<a id="type-gitpod-v1-agent-trace-summary" />

<Accordion title="AgentTraceSummary">
  AgentTraceSummary contains aggregate totals for a date range.

  `gitpod.v1.AgentTraceSummary`

  | Field                    | Type                                                                             | Required | Description                                                                                                                                                             |
  | ------------------------ | -------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `totalSessions`          | 64-bit integer string                                                            | No       | Total number of agent trace sessions in the date range.                                                                                                                 |
  | `totalLinesAdded`        | 64-bit integer string                                                            | No       | Total lines added across all sessions.                                                                                                                                  |
  | `totalLinesRemoved`      | 64-bit integer string                                                            | No       | Total lines removed across all sessions.                                                                                                                                |
  | `byModel`                | array of [AgentTraceModelBreakdown](#type-gitpod-v1-agent-trace-model-breakdown) | No       | Per-model breakdown of session stats.                                                                                                                                   |
  | `totalSessionsTrend`     | number                                                                           | No       | 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. |
  | `totalLinesAddedTrend`   | number                                                                           | No       | Fractional change in total\_lines\_added compared to the previous period.                                                                                               |
  | `totalLinesRemovedTrend` | number                                                                           | No       | Fractional change in total\_lines\_removed compared to the previous period.                                                                                             |
</Accordion>

<a id="type-gitpod-v1-date-range" />

<Accordion title="DateRange">
  DateRange specifies a time period for queries.

  `gitpod.v1.DateRange`

  | Field       | Type               | Required | Description                                                             |
  | ----------- | ------------------ | -------- | ----------------------------------------------------------------------- |
  | `startTime` | RFC 3339 timestamp | Yes      | Start time of the date range (inclusive). Constraints: `required=true`. |
  | `endTime`   | RFC 3339 timestamp | Yes      | End time of the date range (exclusive). Constraints: `required=true`.   |
</Accordion>

<a id="type-gitpod-v1-time-series-point" />

<Accordion title="TimeSeriesPoint">
  `gitpod.v1.TimeSeriesPoint`

  | Field   | Type               | Required | Description                              |
  | ------- | ------------------ | -------- | ---------------------------------------- |
  | `time`  | RFC 3339 timestamp | No       | Timestamp for this data point.           |
  | `value` | integer            | No       | The numerical value for this data point. |
</Accordion>

<a id="enum-gitpod-v1-supported-model" />

<Accordion title="SupportedModel">
  SupportedModel enumerates the LLM models available for agent executions

  | Value                                 | Number | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
  | ------------------------------------- | -----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `SUPPORTED_MODEL_UNSPECIFIED`         |      0 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_3_5`          |      1 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_3_7`          |      2 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_3_7_EXTENDED` |      3 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_4`            |      4 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_4_EXTENDED`   |      5 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_4_5`          |      8 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_4_5_EXTENDED` |      9 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_4_6`          |     18 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_4_6_EXTENDED` |     19 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_SONNET_5`            |     32 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4`              |      6 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_EXTENDED`     |      7 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_5`            |     14 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_5_EXTENDED`   |     15 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_6`            |     16 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_6_EXTENDED`   |     17 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_7`            |     22 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPUS_4_8`            |     31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_HAIKU_4_5`           |     21 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPENAI_4O`           |     10 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPENAI_4O_MINI`      |     11 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPENAI_O1`           |     12 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPENAI_O1_MINI`      |     13 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  | `SUPPORTED_MODEL_OPENAI_AUTO`         |     23 | SUPPORTED\_MODEL\_OPENAI\_AUTO flags a request as OpenAI-bound without encoding a specific model slug. The actual model is chosen by the client (today: native Codex via \~/.codex/config.toml) and captured from the upstream Responses-API response.model field for metering and rate-card lookup. This keeps the proto stable across OpenAI model-catalog churn. Reserved numbers 24-30 are intentionally left free for future OpenAI routing sentinels if we ever need to distinguish sub-families. |
</Accordion>
