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

# Group traces by agent or session with per-group rollups

> Collapse the trace list into groups (by agent or session) with summary
metrics per group — volume, error rate, eval pass/fail + avg score, avg
duration, last activity. Honours the same filters as the list endpoint so a
group's numbers match what `GET /traces?agent_name=<key>` would drill into.

Cost/token rollups are deliberately omitted (they need a per-trace LlmCall
join); this view is for triage by volume/health, not billing.



## OpenAPI

````yaml /openapi.json get /api/v1/traces/group-by
openapi: 3.1.0
info:
  title: DecimalAI Platform
  description: Agent Dataset Lifecycle Platform — Backend API
  version: 0.1.0
servers: []
security:
  - BearerAuth: []
tags:
  - name: traces
    description: >-
      Ingest, search, and inspect agent execution traces. A trace is the atomic
      unit of the platform — every other feature (evaluation, compatibility
      scoring, dataset building) operates on traces. Each trace is auto-tagged
      with the manifest hash of the agent that produced it.
  - name: eval-scores
    description: >-
      Push, fetch, and aggregate per-trace evaluation scores. Scores carry
      source provenance (built-in, DeepEval, LangSmith, custom) and feed the
      unified decision engine, which produces a keep / repair / replay / drop
      verdict per trace.
  - name: skills
    description: >-
      Manage reusable instruction blocks (SKILL.md files) that modify agent
      behavior. Skills are first-class manifest components — changes to a skill
      appear in your regression-check impact reports. Use these endpoints to
      create, version, fork, and sync skills with your local SKILL.md files.
  - name: manifests
    description: >-
      Register and inspect manifest versions. A manifest is a snapshot of your
      agent's structural identity (tools, prompts, models, skills) at a point in
      time. The SDK registers manifests automatically; these endpoints expose
      the underlying records.
  - name: datasets
    description: >-
      Build versioned SFT/DPO training datasets from manifest-classified,
      eval-scored traces. Datasets are reproducible — each version locks the
      manifest and filter set used to build it. Export as JSONL, Parquet, or
      push to HuggingFace Hub.
  - name: replay
    description: >-
      Re-execute historical traces against a new manifest version. Replay is the
      deferred-future capability for behavioral verification of agent changes.
      The SDK creates a replay batch, your worker executes each task, then
      submits results back here for eval scoring.
  - name: registry
    description: >-
      Browse and install community skills from the public skills registry. Each
      registry skill carries a SkillScore — an evidence-tiered quality composite
      computed from real-world evals, benchmarks, and ratings across
      organizations. Installing creates a fork in your org — edits don't affect
      the public version.
  - name: agents
    description: >-
      List and inspect agents, plus their multi-agent topology (orchestrator →
      sub-agent edges discovered from traces). Agents are identified by a stable
      agent_name string set in your SDK init() call.
  - name: import
    description: >-
      Bulk-import historical traces from another observability platform or a
      JSONL backup. Useful for migrating from LangSmith / Braintrust / Langfuse.
      Duplicate trace IDs are silently skipped — re-running an import is safe.
paths:
  /api/v1/traces/group-by:
    get:
      tags:
        - traces
      summary: Group traces by agent or session with per-group rollups
      description: >-
        Collapse the trace list into groups (by agent or session) with summary

        metrics per group — volume, error rate, eval pass/fail + avg score, avg

        duration, last activity. Honours the same filters as the list endpoint
        so a

        group's numbers match what `GET /traces?agent_name=<key>` would drill
        into.


        Cost/token rollups are deliberately omitted (they need a per-trace
        LlmCall

        join); this view is for triage by volume/health, not billing.
      operationId: group_traces_api_v1_traces_group_by_get
      parameters:
        - name: dimension
          in: query
          required: false
          schema:
            enum:
              - agent
              - session
            type: string
            description: >-
              Roll-up dimension: 'agent' (group by agent_name) or 'session'
              (group by session_id).
            default: agent
            title: Dimension
          description: >-
            Roll-up dimension: 'agent' (group by agent_name) or 'session' (group
            by session_id).
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - success
                  - error
                  - degraded
                type: string
              - type: 'null'
            title: Status
        - name: eval_verdict
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by eval verdict, or 'unevaluated' for no verdict yet.
            title: Eval Verdict
          description: Filter by eval verdict, or 'unevaluated' for no verdict yet.
        - name: agent_name
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Agent Name
        - name: manifest_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Manifest Id
        - name: target_manifest_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Target Manifest Id
        - name: compat_status
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Compat Status
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Search
        - name: started_at_from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Started At From
        - name: started_at_to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Started At To
        - name: include_fixtures
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              When false, drop platform-harness fixture agents from the roll-up
              — the UI's default. Ignored when agent_name is set.
            default: true
            title: Include Fixtures
          description: >-
            When false, drop platform-harness fixture agents from the roll-up —
            the UI's default. Ignored when agent_name is set.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            default: 100
            title: Limit
        - name: Authorization
          in: header
          required: false
          schema:
            type: string
            title: Authorization
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Workspace-Id
        - name: decimal_session
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Decimal Session
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Group Traces Api V1 Traces Group By Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Enter your API key (e.g. dai_sk_test_key_001)

````