> ## 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.

# Push external evaluation scores

> Push evaluation scores from an external system (DeepEval, LangSmith, etc.).

Scores are stored as quality scores (category="quality") and combined with
built-in compatibility scores in the unified decision engine.

If a score with the same (trace_id, name, source) already exists, it is
updated (upsert behavior).



## OpenAPI

````yaml /openapi.json post /api/v1/traces/{trace_id}/eval-scores
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/{trace_id}/eval-scores:
    post:
      tags:
        - eval-scores
      summary: Push external evaluation scores
      description: >-
        Push evaluation scores from an external system (DeepEval, LangSmith,
        etc.).


        Scores are stored as quality scores (category="quality") and combined
        with

        built-in compatibility scores in the unified decision engine.


        If a score with the same (trace_id, name, source) already exists, it is

        updated (upsert behavior).
      operationId: push_eval_scores_api_v1_traces__trace_id__eval_scores_post
      parameters:
        - name: trace_id
          in: path
          required: true
          schema:
            type: string
            title: Trace Id
        - name: Authorization
          in: header
          required: false
          schema:
            type: string
            title: Authorization
        - name: decimal_session
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Decimal Session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PushScoresRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PushScoresResponse'
              example:
                trace_id: trc_abc123
                source: deepeval
                scores_stored: 2
                scores:
                  - id: es_001
                    name: correctness
                    score: 0.9
                    passed: true
                    source: deepeval
                    category: quality
                  - id: es_002
                    name: faithfulness
                    score: 0.85
                    passed: true
                    source: deepeval
                    category: quality
        '404':
          description: Trace not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: Python
          label: Python SDK
          source: >-
            # For DeepEval / LangSmith integrations, prefer the dedicated
            helpers:

            #   decimalai.push_deepeval_results(trace_id=..., results=...)

            #   decimalai.push_langsmith_scores(trace_id=..., feedback=...)

            # Generic custom scores:

            import decimalai


            decimalai.push_custom_scores(
                api_key="dai_sk_...",
                trace_id="trc_abc123",
                source="my-pipeline",
                scores=[
                    {"name": "correctness", "score": 0.9},
                    {"name": "faithfulness", "score": 0.85},
                ],
            )
components:
  schemas:
    PushScoresRequest:
      properties:
        source:
          type: string
          title: Source
          description: >-
            Source system: 'custom', 'my-pipeline', etc. (reserved external-tool
            names like 'deepeval' require the webhook path)
        scores:
          items:
            $ref: '#/components/schemas/ScoreInput'
          type: array
          minItems: 1
          title: Scores
          description: List of scores to push
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Source-specific metadata (run_id, metric version, etc.)
      type: object
      required:
        - source
        - scores
      title: PushScoresRequest
      description: Request body for pushing external eval scores.
    PushScoresResponse:
      properties:
        trace_id:
          type: string
          title: Trace Id
        source:
          type: string
          title: Source
        scores_stored:
          type: integer
          title: Scores Stored
        scores:
          items:
            $ref: '#/components/schemas/ScoreResponse'
          type: array
          title: Scores
      type: object
      required:
        - trace_id
        - source
        - scores_stored
        - scores
      title: PushScoresResponse
      description: Response after pushing scores.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ScoreInput:
      properties:
        name:
          type: string
          maxLength: 255
          title: Name
          description: Metric name, e.g. 'correctness', 'faithfulness'
        score:
          type: number
          maximum: 1
          minimum: 0
          title: Score
          description: Score value 0.0–1.0
        passed:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Passed
          description: Binary pass/fail. Auto-derived from score >= 0.5 if omitted
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
          description: Human-readable explanation
      type: object
      required:
        - name
        - score
      title: ScoreInput
      description: A single evaluation score.
    ScoreResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        score:
          type: number
          title: Score
        passed:
          type: boolean
          title: Passed
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        source:
          type: string
          title: Source
        source_label:
          type: string
          title: Source Label
          default: ''
        icon:
          type: string
          title: Icon
          default: ''
        badge_color:
          type: string
          title: Badge Color
          default: ''
        category:
          type: string
          title: Category
        change_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Change Type
        field_changes:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Field Changes
      type: object
      required:
        - id
        - name
        - score
        - passed
        - source
        - category
      title: ScoreResponse
      description: A single stored score in the response, with provenance.
    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)

````