phoenix-server

Guides backend development of Phoenix's FastAPI, Strawberry GraphQL, and SQLAlchemy server codebase.

11.3k|1.1k|Updated Nov 9, 2022
One-click install
npx skills add https://github.com/Arize-ai/phoenix --skill phoenix-server
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-server
Source: https://github.com/Arize-ai/phoenix/tree/main/.agents/skills/phoenix-server
Command: npx skills add https://github.com/Arize-ai/phoenix --skill phoenix-server

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Backend work on the Phoenix AI observability platform involves conventions that are easy to get wrong: GraphQL mutations vs queries, Alembic migrations that must stay SQLite-compatible, async session lifecycle, and test patterns for LLM span emission. This Skill encodes those conventions so changes to src/phoenix/server/, src/phoenix/db/, and tests/unit/server/ follow the project's established patterns.

Core Features & Use Cases

  • GraphQL Patterns: Templates for mutations, types, subscriptions, and input types, including the hard rule that side effects belong on Mutation with permission classes to avoid unauthenticated SSRF vectors.
  • Database Patterns: Alembic migration scaffolding, batch_alter_table for SQLite compatibility, self-contained JSONB shims, and async session management rules.
  • Test Patterns: Fixtures like db and gql_client, mutation/query test templates, GlobalID handling, and VCR cassette workflows for deterministic LLM trace tests with OpenInference span assertions.
  • Use Case: When adding a new mutation to the Phoenix GraphQL API, follow the mixin template, register it in mutations/init.py, run make graphql, and write a test asserting both result.data and database state.

Quick Start

Ask the assistant to add a new GraphQL mutation with input validation, permission classes, and a matching unit test to the Phoenix backend.

Frequently Asked Questions about phoenix-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a GraphQL mutation in the Phoenix backend?

Define a Strawberry input type with validation in __post_init__, create a payload type, write the mutation in a mixin class with permission_classes, register the mixin in mutations/__init__.py, then run make graphql to regenerate the schema.

How do I write an Alembic migration that works with SQLite?

Scaffold with uv run alembic revision, then use op.batch_alter_table for all column additions, drops, and constraint changes since SQLite has limited ALTER TABLE support. Migrations must be self-contained and redefine custom types like JSONB inline.

Why must side effects go on Mutation instead of Query in Strawberry GraphQL?

Query fields bypass the check-graphql-permissions CI guard and are reachable unauthenticated by default. A query resolver making network calls with a user-supplied URL is an SSRF vector, so side effects must be mutations with permission_classes.

How do I test code that emits OpenInference spans against an LLM provider?

Use the CustomVCR fixture with record_mode once to replay the HTTP exchange deterministically, wire in a fake API key fixture, and assert span attributes with the pop pattern ending in assert not attributes to catch unexpected keys.

What test fixtures are available for Phoenix backend unit tests?

The db fixture provides an async session factory with per-test transaction isolation, gql_client executes GraphQL operations over HTTP, httpx_client hits REST endpoints, and dialect parametrizes tests across SQLite and PostgreSQL.

When should I re-record a VCR cassette instead of editing it?

Always delete and re-record when the outgoing request changes, since VCR with record_mode once refuses mismatched requests. Hand-editing cassettes lets them diverge from real provider responses and masks bugs.