New to Claude Skills? Learn how to install them →

arize-ai on GitHub

Phoenix GraphQL

Free

Efficiently query the Phoenix API with GraphQL.

by arize-ai11k stars on arize-ai/phoenix
2 views
Updated Aug 11, 2026
Get this skill

Free · Opens the source repo

What Phoenix GraphQL does

Phoenix GraphQL is a skill designed for developers and data analysts who need to interact with the Phoenix API using GraphQL queries. This skill provides two primary modes of operation: internal data analysis and user integration support. In the internal mode, users can compose their own GraphQL queries to extract insights from the Phoenix data, leveraging schema facts, efficiency rules, and established patterns to streamline their queries. In the integration support mode, the skill assists users in generating GraphQL queries for their own scripts, tools, or integrations, ensuring they have the necessary endpoint, authentication, and client examples at their disposal.

The skill is built around a set of entrypoints that facilitate easy access to various entities within the Phoenix ecosystem. Key entrypoints include node(id: ID!) for global lookups, as well as specific queries for projects, datasets, prompts, and experiments. Users can efficiently filter and sort results using Relay connections, while the skill also provides guidance on pagination and variable usage to optimize query performance. Efficiency rules discourage unnecessary schema introspection, promoting best practices such as batching lookups and minimizing data retrieval to only what is needed.

For those looking to integrate Phoenix with their applications, the skill provides comprehensive resources, including a schema map that outlines entity-specific fields and examples. Users can access detailed information about project spans, sessions, datasets, experiments, prompts, and annotations, allowing them to tailor their queries to their specific needs. This skill is particularly useful for developers working on data analysis projects or building tools that require seamless integration with the Phoenix API.

When to use it

Use this skill when you need to compose GraphQL queries for data analysis or when integrating Phoenix API calls into your applications.

When not to use it

This skill may not be suitable for users unfamiliar with GraphQL, or for those who require extensive custom query capabilities beyond what is provided.

What you can build with it

Data Analysis

Use the skill to compose GraphQL queries for analyzing datasets within the Phoenix API, leveraging schema facts for efficient data retrieval.

API Integration

Integrate Phoenix API calls into your applications by utilizing the skill to generate the necessary GraphQL queries and handle authentication.

Experiment Comparison

Leverage the skill to compare different experiments within the Phoenix API, using the provided queries to analyze performance metrics.

How to install Phoenix GraphQL

View source

1. Install with the skills CLI

npx skills add arize-ai/phoenix/phoenix-graphql --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by arize-ai

Two modes

  • Internal data analysis — you are querying Phoenix yourself to answer a question. Apply the schema facts, efficiency rules, and patterns below directly.
  • Helping the user integrate — the user wants GraphQL queries for their own code or tools. Use the same schema facts and patterns, plus the "External API usage" section for endpoint, auth, and client examples. Queries you hand to the user should use variables and include pagination handling.

Entrypoints

Top-level Query entrypoints get you to a starting entity; per-entity schema details live in the resources listed under "Schema map" below.

  • node(id: ID!) — global lookup for any entity by its Relay global id; resolve with an inline fragment, e.g. node(id: $id) { ... on Dataset { name } }. This is the primary way to fetch datasets, prompts, experiments, sessions, and annotations, which have no by-name/by-id helpers.
  • projects(...), datasets(...), prompts(...), evaluators(...) → Relay connections, each with filter/sort inputs to find an entity when you only have a name.
  • By-X helpers (the only ones that exist): getProjectByName(name: String!), getProjectSessionById(sessionId: String!), getDatasetExampleByExternalId(datasetId: GlobalID!, externalId: String!), getSpanByOtelId(spanId: String!), getTraceByOtelId(traceId: String!). There is no getDatasetByName, getPromptByName, or getExperimentById — use node(id:) or a connection filter instead.
  • viewer → the authenticated User; projectCount, datasetCount, promptCount — cheap counts.
  • compareExperiments(baseExperimentId: GlobalID!, compareExperimentIds: [GlobalID!]!, first, after, filterCondition) → experiment comparison.

Schema map

Per-entity field references and examples are split into resources. Read only the one(s) you need with read_skill_resource, after loading this skill:

  • project-spans-traces — Project aggregates and spans; Span and Trace fields. The starting point for most trace analysis.
  • sessions — ProjectSession: multi-turn session metrics, token/cost, session traces.
  • datasets — Dataset and DatasetExample: examples, versions, splits, labels.
  • experiments — Experiment and ExperimentRun: runs, aggregate metrics, comparison.
  • prompts — Prompt and PromptVersion: versions, templates, tags.
  • annotations — Span/Trace/ExperimentRun annotation fields and how to read them.

Conventions

These apply to every entity:

  • Pagination is Relay-style: first/after args; responses have edges { node { ... } } and pageInfo { hasNextPage endCursor }. Cursors are opaque strings. Some connections (e.g. Project.spans, Experiment.runs, ProjectSession.traces) are forward-only.
  • IDs: the id field on any node is a Relay global ID (base64 of TypeName:rowId) — use it with node(id:). OpenTelemetry hex IDs come from Span.spanId and Trace.traceId — use those for OTel lookups. Note a Span has no traceId field; read it via the nested trace { traceId }. Never mix global IDs with OTel IDs.
  • TimeRange input: { start: DateTime, end: DateTime } — ISO 8601 strings; end is exclusive; both optional.
  • SpanSort input: { col: SpanColumn, dir: SortDir }, e.g. { col: startTime, dir: desc }. Useful SpanColumn values: startTime, latencyMs, tokenCountTotal, cumulativeTokenCountTotal, tokenCostTotal.
  • filterCondition is a Python-like DSL string over span fields, e.g. span_kind == 'LLM', status_code == 'ERROR', latency_ms > 1000, 'timeout' in output.value, annotations['Hallucination'].label == 'hallucinated', or trace_annotations['quality'].score < 0.5. annotations[...] references annotations on an individual span; trace_annotations[...] matches every span belonging to an annotated trace. Combine clauses with and/or.

Efficiency rules

  • Do not run full schema introspection. Read the relevant Schema map resource instead; it covers the fields and arguments for that entity. Only when a resource does not cover a field you need, introspect a single type: { __type(name: "Project") { fields { name args { name type { name kind } } } } }.
  • Batch independent lookups with aliases in one query instead of multiple round trips, e.g. p50: latencyMsQuantile(probability: 0.5) p99: latencyMsQuantile(probability: 0.99).
  • Select only the fields you need; keep page sizes small (10–50) and paginate only when necessary.
  • Pass values via query variables, never string interpolation.
  • Span input/output payloads can be huge — request input { truncatedValue } (first 100 chars) when surveying; fetch input { value } (full payload) only for spans you intend to read closely.

Patterns

Two canonical shapes to orient you; entity-specific examples live in each resource.

Reach an entity and read fields via node(id:) + an inline fragment:

query GetEntity($id: ID!) {
  node(id: $id) {
    ... on Dataset { name exampleCount }
  }
}

Batch independent project aggregates with aliases in one round trip:

query Overview($name: String!, $timeRange: TimeRange) {
  getProjectByName(name: $name) {
    traceCount(timeRange: $timeRange)
    p50: latencyMsQuantile(probability: 0.5, timeRange: $timeRange)
    p99: latencyMsQuantile(probability: 0.99, timeRange: $timeRange)
    errorCount: recordCount(timeRange: $timeRange, filterCondition: "status_code == 'ERROR'")
  }
}

Execution surfaces (internal mode)

  • phoenix-gql (bash): run phoenix-gql --help for flags and current permissions. Use --data-only when piping to jq, --output <file> for large results, --vars '<json>' for variables. Mutations are allowed only when runtime permissions say so; the tool reports its permissions on every invocation.

External API usage (user-facing mode)

Facts users need to call the API themselves:

  • Endpoint: POST <phoenix-endpoint>/graphql with a JSON body { "query": "...", "variables": { ... } }, where <phoenix-endpoint> is the Phoenix base URL from PHOENIX_ENDPOINT. A GraphiQL IDE is served on GET at the same path.
  • Auth: send a Phoenix API key as a bearer token: Authorization: Bearer <API_KEY>. API keys are created in Phoenix settings.
  • The GraphQL schema is primarily designed for the Phoenix UI and may change between versions; for stable programmatic access, recommend the REST API (/v1/...) and the arize-phoenix-client Python / @arizeai/phoenix-client TypeScript packages where they cover the need, and GraphQL for everything else.

curl:

curl -s "$PHOENIX_ENDPOINT/graphql" \
  -H "Authorization: Bearer $PHOENIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "query($n: String!) { getProjectByName(name: $n) { traceCount } }", "variables": {"n": "default"}}'

Python:

import httpx

resp = httpx.post(
    f"{endpoint}/graphql",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"query": query, "variables": variables},
)
resp.raise_for_status()
data = resp.json()["data"]

When handing users a query, include: the full operation with variable definitions, an example variables payload, and a note on paginating via pageInfo { hasNextPage endCursor } → pass endCursor as after.

Frequently asked questions about Phoenix GraphQL

Similar skills