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

# Trace/cost/latency stats for one agent (accepts a UUID or agent name).



## OpenAPI

````yaml /api-reference/openapi.json get /api/observability/agent/{agent_id}/stats
openapi: 3.1.0
info:
  title: Nasiko API
  description: >-
    HTTP API for the Nasiko OpenRuntime: agents, coding harnesses, TokenOps,
    routing, MCP, and secrets. Spec is generated from annotated routes; some
    surfaces are documented on the hand-written pages alongside this file.
  license:
    name: ''
  version: 0.1.0
servers: []
security: []
tags:
  - name: secrets
    description: Encrypted per-user agent secrets
  - name: catalog
    description: >-
      Agent catalog: registration, discovery, versions, per-agent secrets, and
      source import
  - name: agents
    description: >-
      Agent lifecycle: deployments, LLM routing config, update/rollback,
      upload-and-deploy
  - name: orchestrator
    description: >-
      A2A dispatch: routing-engine/ReAct orchestrator and direct agent chat,
      plus routing stats
  - name: users
    description: >-
      User management: CRUD, roles, credentials, accessible agents
      (superuser-only)
  - name: usage
    description: Per-user token usage and cost reporting
  - name: observability
    description: Sessions, traces, spans, agent logs, and FinOps reporting
  - name: llm-router
    description: LLM routing presets, provider/model catalog, and tier→model registry
  - name: mcp
    description: >-
      MCP gateway: agent-facing JSON-RPC tool calls, connector
      registration/upload/sharing, credentials & OAuth, and per-agent tool
      permissions
paths:
  /api/observability/agent/{agent_id}/stats:
    get:
      tags:
        - observability
      summary: Trace/cost/latency stats for one agent (accepts a UUID or agent name).
      operationId: get_agent_stats
      parameters:
        - name: agent_id
          in: path
          description: Agent UUID or name
          required: true
          schema:
            type: string
        - name: start_time
          in: query
          description: |-
            Optional — the service defaults to the last 24 hours, matching the
            other observe endpoints (the UI calls this with no params at all).
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: Agent stats
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentStatsResponse'
        '401':
          description: Missing or invalid session
components:
  schemas:
    AgentStatsResponse:
      type: object
      required:
        - data
        - status_code
        - message
      properties:
        data:
          $ref: '#/components/schemas/AgentStatsData'
        message:
          type: string
        status_code:
          type: integer
          format: int32
          minimum: 0
    AgentStatsData:
      type: object
      required:
        - project
      properties:
        project:
          $ref: '#/components/schemas/AgentProjectStats'
    AgentProjectStats:
      type: object
      required:
        - id
        - trace_count
        - cost_summary
        - span_annotation_names
        - document_evaluation_names
      properties:
        cost_summary:
          $ref: '#/components/schemas/NestedCostSummary'
        document_evaluation_names:
          type: array
          items:
            type: string
        id:
          type: string
        latency_ms_p50:
          type:
            - number
            - 'null'
          format: double
        latency_ms_p99:
          type:
            - number
            - 'null'
          format: double
        span_annotation_names:
          type: array
          items:
            type: string
        trace_count:
          type: integer
          minimum: 0
    NestedCostSummary:
      type: object
      required:
        - total
        - prompt
        - completion
        - cache_read
        - cache_creation
      properties:
        cache_creation:
          $ref: '#/components/schemas/CostOnly'
        cache_read:
          $ref: '#/components/schemas/CostOnly'
        completion:
          $ref: '#/components/schemas/CostOnly'
        prompt:
          $ref: '#/components/schemas/CostOnly'
        total:
          $ref: '#/components/schemas/CostOnly'
    CostOnly:
      type: object
      required:
        - cost
      properties:
        cost:
          type: number
          format: double

````