Logo de Phoenix Pxi Playwright

Phoenix Pxi Playwright

OrganizaçãoPopular
Arize-ai
phoenix-pxi-playwright

Escreva, amplie e depure testes E2E PXI com Playwright para o Phoenix. Use ao adicionar especificações para o frontend de agentes PXI, criar critérios de avaliação LLM-as-judge, verificar o uso de ferramentas PXI, salvar execuções de testes PXI como experimentos do Phoenix ou depurar falhas em testes E2E PXI.

Add to TypingMind

Visão geral

Publicado porArize-ai
Repositóriophoenix
Nome da habilidadephoenix-pxi-playwright
Estrelas
11.8K
Forks
1.2K
Arquivos incluídos
Somente instruções
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por Arize-ai no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Phoenix Pxi Playwright no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/Arize-ai/phoenix/tree/main/.agents/skills/phoenix-pxi-playwright
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Arize-ai/phoenix.git /tmp/phoenix
mkdir -p .claude/skills
cp -r /tmp/phoenix/.agents/skills/phoenix-pxi-playwright .claude/skills/phoenix-pxi-playwright
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Phoenix Pxi Playwright em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Phoenix Pxi Playwright automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Phoenix Pxi Playwright não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Phoenix PXI Playwright Tests

Use this skill when authoring or maintaining Playwright specs for PXI, Phoenix's built-in AI assistant. The concrete harness lives in js/app/tests/pxi/; this skill is the authoring guide for using and extending that harness.

Start Here

  • Read the existing example spec first: js/app/tests/pxi/docs-smoke.spec.ts.
  • Reuse the shared fixture and driver from js/app/tests/pxi/fixtures.ts.
  • Reuse shared constants from js/app/tests/pxi/constants.ts and shared types from js/app/tests/pxi/types.ts.
  • Put pure parsing/API helpers in js/app/tests/pxi/utils.ts rather than in specs or fixture classes.
  • Reuse the generic AI SDK judge from js/app/tests/pxi/judge.ts.
  • Reuse experiment persistence from js/app/tests/pxi/experimentPersistence.ts.
  • Add one entry to PXI_EXPERIMENT_EXAMPLES in js/app/tests/pxi/experimentPersistence.ts for every new PXI spec scenario. All specs share the same dataset, and the update upload treats that registry as the complete desired set of examples.
  • Do not create a bespoke PXI driver, duplicate experiment client, or duplicate PXI tool schemas in a spec.

Current Harness

The current harness provides these abstractions:

  • test and expect from ./fixtures: PXI-aware Playwright fixture exports.
  • constants.ts: default assistant and judge model/project constants.
  • types.ts: shared PXI harness types such as PxiTurn.
  • utils.ts: pure utilities for API response validation and span/tool parsing.
  • pxi.open(): opens PXI for the test session.
  • pxi.acknowledgeConsent(): accepts PXI consent for the test session.
  • pxi.askAndWait(prompt): sends a user prompt and waits for the assistant turn. It does not require a backend TOOL span; add explicit tool assertions in the spec.
  • pxi.expectNoAgentError(): asserts the visible PXI session did not surface an agent error.
  • pxi.expectBackendToolSpanCalled(turn): asserts the PXI turn produced at least one persisted backend TOOL span and merges those backend tool names into turn.calledTools. Use this for server/MCP-backed tools such as docs tools, not for purely client-executed external tools.
  • pxi.expectDocsToolCalled(turn): asserts the PXI turn used runtime docs tooling via Phoenix-observed tool spans.
  • pxi.getMetadata(): collects PXI metadata for persistence.
  • judge({ model, system, prompt, assistantText, rubric }): evaluates an assistant answer with AI SDK generateText and structured Output.object.
  • evaluatePxiOutcome({ assertions, judgeInput }): runs deterministic assertions and LLM judging while preserving failed post-turn outcomes for experiment persistence.
  • assertPxiOutcome(outcome): fails the Playwright test after persistence, preferring the original deterministic assertion failure when one exists.
  • persistPxiExperiment({ request, record }): stores the PXI interaction, judge result, and metadata as a Phoenix experiment.

Authoring Workflow

  1. Add the scenario prompt and expected output to PXI_EXPERIMENT_EXAMPLES so the shared PXI E2E dataset gets one example per test scenario.
  2. Put the scenario prompt, PXI user instructions, and judge rubric in the spec file so the test is readable top-to-bottom. Import the scenario from PXI_EXPERIMENT_EXAMPLES rather than duplicating prompt strings.
  3. Drive PXI through the real UI with pxi.open, pxi.acknowledgeConsent, and pxi.askAndWait.
  4. Add deterministic assertions before judge assertions, such as expected text, no agent error, or expected tool use.
  5. Put all post-turn deterministic assertions inside evaluatePxiOutcome, including pxi.expectBackendToolSpanCalled(turn), so failures after PXI returns an answer still get persisted.
  6. After pxi.askAndWait returns a turn, persist both passing and failing outcomes. Do not let deterministic assertion failures skip experiment persistence.
  7. Use evaluatePxiOutcome instead of writing per-spec try/catch blocks. It runs judge even when deterministic Playwright assertions fail, then combines the judge explanation with a sanitized, truncated Playwright assertion message in the persisted failed evaluation.
  8. Run the targeted spec with isolated ports before reporting success.

Spec Pattern

ts
import {
  persistPxiExperiment,
  PXI_EXPERIMENT_EXAMPLES,
} from "./experimentPersistence";
import { expect, test } from "./fixtures";
import { getRequiredJudgeApiKeyEnv } from "./judge";
import { assertPxiOutcome, evaluatePxiOutcome } from "./outcome";

const EXPERIMENT_EXAMPLE = PXI_EXPERIMENT_EXAMPLES.someScenario;
const USER_PROMPT = EXPERIMENT_EXAMPLE.prompt;
const JUDGE_RUBRIC = [
  "The answer satisfies the user request.",
  "The answer is grounded in the expected Phoenix context.",
  "The answer does not invent unsupported facts.",
];
const JUDGE_API_KEY_ENV = getRequiredJudgeApiKeyEnv();

test.describe("PXI scenario", () => {
  test("handles the scenario", async ({
    browserName,
    page,
    pxi,
    request,
  }, testInfo) => {
    test.skip(
      browserName !== "chromium",
      "PXI real-LLM smoke runs once in chromium."
    );
    test.skip(
      process.env.PXI_E2E !== "true",
      "Set PXI_E2E=true to run PXI E2E tests."
    );
    test.skip(
      !process.env.OPENAI_API_KEY,
      "OPENAI_API_KEY is required for the PXI assistant."
    );
    test.skip(
      !process.env[JUDGE_API_KEY_ENV],
      `${JUDGE_API_KEY_ENV} is required for the PXI E2E judge.`
    );

    await pxi.open();
    await pxi.acknowledgeConsent();

    const turn = await pxi.askAndWait(USER_PROMPT);
    const outcome = await evaluatePxiOutcome({
      assertions: async () => {
        await pxi.expectNoAgentError();
        // For server/MCP-backed tools only. Client-executed external tools can
        // be asserted through visible tool UI or final app state instead.
        await pxi.expectBackendToolSpanCalled(turn);
        expect(turn.assistantText).toContain("deterministic expected text");
      },
      judgeInput: {
        system: "You are judging a Phoenix PXI E2E answer.",
        prompt: USER_PROMPT,
        assistantText: turn.assistantText,
        rubric: JUDGE_RUBRIC,
      },
    });

    await persistPxiExperiment({
      request,
      record: {
        example: EXPERIMENT_EXAMPLE,
        assistantText: turn.assistantText,
        calledTools: turn.calledTools,
        url: page.url(),
        durationMs: turn.durationMs,
        judgeResult: outcome.judgeResult,
        playwrightProject: testInfo.project.name,
        ...pxi.getMetadata(),
      },
    });

    assertPxiOutcome(outcome);
  });
});

Judge Models

  • Pass judge models as provider/model strings.
  • Default: openai/gpt-4.1 via PXI_E2E_JUDGE_MODEL fallback.
  • Supported providers are currently openai and anthropic.
  • openai/... requires OPENAI_API_KEY.
  • anthropic/... requires ANTHROPIC_API_KEY.
  • The judge must use AI SDK 6 structured output idioms: generateText with Output.object({ schema }). Do not use deprecated generateObject.

Running Specs

Use isolated ports to avoid collisions with a local Phoenix dev server:

bash
pnpm run test:e2e:pxi

Real PXI specs require external model credentials. Keep tests skipped by default unless PXI_E2E=true is set.

When PXI_E2E=true, the Playwright config runs with one worker because PXI specs share a Phoenix test server/database and may mutate agent-visible setup such as sandbox configs.

Experiment Persistence

  • Persistence defaults to http://localhost:6006 so real E2E runs can be inspected in the developer's local Phoenix instance.
  • Override with PXI_E2E_EXPERIMENT_BASE_URL.
  • Use PXI_E2E_EXPERIMENT_BEARER_TOKEN only when persisting to an authenticated Phoenix target.
  • All PXI specs share the PXI E2E Agent Tests dataset. persistPxiExperiment uploads every entry in PXI_EXPERIMENT_EXAMPLES using action: "update", so adding or removing an entry updates the dataset examples declaratively.
  • Every new PXI spec must add one PXI_EXPERIMENT_EXAMPLES entry with a stable id, prompt, expected output, experiment name prefix, and experiment description, then pass that entry as record.example.
  • Persist the complete test record: prompt, assistant text, called tools, duration, judge result, Playwright project, URL, and PXI metadata.
  • Persist failed post-turn outcomes too. If PXI returned an answer, the experiment run should exist even when deterministic assertions or judge checks fail.
  • Let evaluatePxiOutcome strip ANSI escape sequences and truncate Playwright assertion messages before they are added to judgeResult.explanation; raw Playwright error messages are terminal-formatted and too noisy for Phoenix experiment tables.

Tool Assertions

  • Use pxi.expectBackendToolSpanCalled(turn) when the scenario requires a server-observed backend TOOL span. Keep the call inside evaluatePxiOutcome.
  • Use pxi.expectDocsToolCalled(turn) after pxi.expectBackendToolSpanCalled(turn) for docs scenarios because it checks the backend tool names merged into turn.calledTools.
  • Do not require backend TOOL spans for client-executed external tools such as UI control tools. Assert their visible tool chips, tool result text, or the resulting app state instead.

Extending The Harness

If fixtures.ts, judge.ts, or experimentPersistence.ts do not satisfy a testing use case, use internal_docs/pxi_playwright_e2e_harness.md as the design guide for extending the harness, utilities, and this skill together. That internal doc describes the intended architecture for richer PXI drivers, seed fixtures, LLM modes, outcome assertions, experiment persistence, and debugging artifacts.

Prefer small harness extensions that make future specs simpler. Do not add one-off logic to an individual spec if it should be reusable across PXI E2E scenarios.

Keep This Skill Fresh

When a session creates new PXI Playwright capabilities, discovers a reliable assertion pattern, changes judge behavior, adds seed fixtures, or learns a debugging technique, update this skill in the same branch. Future developers and agents should not have to rediscover branch-specific harness behavior.

Perguntas frequentes

O que a habilidade de IA Phoenix Pxi Playwright faz?

Escreva, amplie e depure testes E2E PXI com Playwright para o Phoenix. Use ao adicionar especificações para o frontend de agentes PXI, criar critérios de avaliação LLM-as-judge, verificar o uso de ferramentas PXI, salvar execuções de testes PXI como experimentos do Phoenix ou depurar falhas em testes E2E PXI.

Por que usar Phoenix Pxi Playwright no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Phoenix Pxi Playwright é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Phoenix Pxi Playwright no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/Arize-ai/phoenix/tree/main/.agents/skills/phoenix-pxi-playwright. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Phoenix Pxi Playwright?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Phoenix Pxi Playwright?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Phoenix Pxi Playwright com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Phoenix Pxi Playwright é gratuita?

A habilidade é publicada no GitHub por Arize-ai. Consulte os termos de licenciamento no repositório. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇