Skip to content
Development
Agent

project-spans-traces

- `Project.spans(first, after, timeRange, sort: SpanSort, filterCondition: String, traceFilterCondition: String)` → connection of `Span`. There is **no `traces` connection on `Project`** and no root-span argument: list traces with `spans(filterCondition: "parent_span is None")`,

From plugin
phoenix
12k18 skills18 agents1 MCP

Claude Code

> /plugin marketplace add arize-ai/phoenix
> /plugin install arize-phoenix@arize-phoenix

Agent definition

project-spans-traces.md

Project, Span, Trace

Project

  • `Project.spans(first, after, timeRange, sort: SpanSort, filterCondition: String, traceFilterCondition: String)` → connection of `Span`. There is **no `traces` connection on `Project`** and no root-span argument: list traces with `spans(filterCondition: "parent_span is None")`, which keeps root spans including orphans whose parent was never received (what the UI's traces table runs), usually one per trace; `parent_id is None` keeps only spans with no parent id. Pair with `traceFilterCondition` to keep the roots of matching traces.
  • `Project.trace(traceId: ID!)` → `Trace` — lookup by OTel hex trace id.
  • Aggregates, most accepting `timeRange` and `filterCondition`: `traceCount`, `recordCount` (span count), `tokenCountTotal`, `tokenCountPrompt`, `tokenCountCompletion`, `costSummary`, `latencyMsQuantile(probability: Float!)`, `spanLatencyMsQuantile(probability: Float!)`.
  • Discovery fields: `spanAnnotationNames`, `traceAnnotationNames`, `spanAnnotationSummary`, `documentEvaluationNames` — check which evals/annotations exist before querying them.
  • `validateSpanFilterCondition(condition: String!)` — check a filter string without running it.
  • `filterCondition` is a span filter expression and `traceFilterCondition` a trace filter expression; both languages are specified in `references/filter-expressions.md` (vocabulary, operators, root-span scoping, compiled examples).

Span

Key fields: `spanId` (OTel hex), `name`, `spanKind`, `statusCode`, `startTime`, `latencyMs`, `cumulativeTokenCountTotal`, `input { truncatedValue value }`, `output { truncatedValue value }`, `spanAnnotations { name label score }`, `trace { traceId }`. **`Span` has no `traceId` field** — read the OTel trace id via the nested `trace { traceId }`.

Trace

Key fields: `traceId`, `latencyMs`, `numSpans`, `rootSpan { ... }` (the representative root span: the earliest span with no parent, or whose parent was never received — use it for a one-line turn/trace summary), `spans(first, after, filterCondition)`, `projectSessionId`.

Examples

Recent root spans (usually one per trace), slowest first:

query RecentTraces($id: ID!, $first: Int = 20) {
  node(id: $id) {
    ... on Project {
      spans(first: $first, filterCondition: "parent_span is None", sort: { col: latencyMs, dir: desc }) {
        edges {
          node {
            spanId
            name
            latencyMs
            statusCode
            startTime
            cumulativeTokenCountTotal
            trace { traceId numSpans }
          }
        }
        pageInfo { hasNextPage endCursor }
      }
    }
  }
}

Root spans of errored traces in a time window:

query ErroredTraces($id: ID!, $timeRange: TimeRange) {
  node(id: $id) {
    ... on Project {
      spans(
        first: 20
        timeRange: $timeRange
        filterCondition: "parent_span is None"
        traceFilterCondition: "error_count > 0"
      ) {
        edges { node { name latencyMs input { truncatedValue } trace { traceId } } }
      }
    }
  }
}

Filtered spans (error LLM spans):

query ErrorSpans($id: ID!) {
  node(id: $id) {
    ... on Project {
      spans(first: 20, filterCondition: "span_kind == 'LLM' and status_code == 'ERROR'") {
        edges { node { spanId name statusCode trace { traceId } } }
      }
    }
  }
}
Read more
@arize-ai
Ships withphoenix

AI Observability & Evaluation

12k10 skills18 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
12.1k
Star history of arize-ai/phoenix on GitHub, a chart by star-history.com

Other agents on phoenix.

bug-fixer

bug-fixer

Agent

Leads one Phoenix bug from report to draft PR - reproduce, fix, review, revise.

@arize-ai@arize-aiInstall Agent
bug-reproducer

bug-reproducer

Agent

Reproduces a reported Phoenix bug as a failing automated test. Give it the issue number, labels, the bootstrap report and the…

@arize-ai@arize-aiInstall Agent
cloud-triage

cloud-triage

Agent

Reads a day of Phoenix Cloud production errors from Datadog, decides which are bugs a maintainer should fix, and makes sure each…

@arize-ai@arize-aiInstall Agent
docs-writer

docs-writer

Agent

Makes one Phoenix documentation change, grounded in the current code, and opens a draft PR.

@arize-ai@arize-aiInstall Agent
feature-analyst

feature-analyst

Agent

Analyst that turns a Phoenix feature request into an implementation plan grounded in the existing code, starting with a probe…

@arize-ai@arize-aiInstall Agent

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc11d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react1d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codextoday135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman2d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about project-spans-traces.

Which coding agents can use project-spans-traces?
project-spans-traces installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.