with one click
typescript-sdk
TypeScript SDK patterns for Opik. Use when working in sdks/typescript.
Menu
TypeScript SDK patterns for Opik. Use when working in sdks/typescript.
| name | typescript-sdk |
| description | TypeScript SDK patterns for Opik. Use when working in sdks/typescript. |
Public API → OpikClient → Domain (Trace/Span) → BatchQueues → REST Client → Backend
README.md and integration README files in the same PR.// ✅ REQUIRED - especially in CLI/tests
await client.flush();
// or globally:
await flushAll();
// ✅ GOOD - domain objects enqueue, not HTTP
trace.update({ metadata: { key: 'value' } }); // Enqueues update
trace.end(); // Enqueues update
// ❌ BAD - don't call REST directly from domain
// ✅ GOOD - export from public API
export { Opik, track, flushAll } from 'opik';
// ❌ BAD - don't expose generated clients
import { TracesApi } from 'opik/rest_api'; // Internal!
flush() flushes all queues in orderOpikConfigOpikApiError, OpikApiTimeoutErrorDatasetNotFoundError, ExperimentNotFoundErrorflush() escape hatch if neededUse when an Opik E2E test has failed and a developer wants it investigated — e.g. "why did this e2e test fail?", "investigate the failing run on my PR", "is dataset-crud-smoke flaky?", "the nightly e2e suite went red". Takes a failure from a CI check, a TestOps launch, a test name, or a local run; gathers the trace and history, classifies regression vs. flake, and proposes a fix. Read-only — it diagnoses and proposes, it does not edit tests.
Use when building or extending a Page Object Model (POM) for the Opik E2E suite (under `tests_end_to_end/e2e/pom/`) and you need to choose stable selectors against the live UI. Walks through seeding required state, exploring the running page with the Playwright MCP (accessibility snapshot + data-testid enumeration), picking the most stable locator for each element, and verifying it before committing. Used as the discovery sub-step by the `writing-e2e-tests` skill.
Use when a developer wants to add, write, or create an end-to-end test for an Opik feature, page, or branch — e.g. "add an e2e test for the experiments comparison page", "write a test for the feature I just built", "e2e test for this branch", "cover the dataset items flow with a test". Runs the full loop in tests_end_to_end/e2e/ — analyze the feature and frontend code, explore the live UI with the Playwright MCP, write the Page Object Model + spec, and run it locally until green.
Java backend patterns for Opik. Use when working in apps/opik-backend, designing APIs, database operations, or services.
React frontend patterns for Opik. Use when working in apps/opik-frontend, on components, state, or data fetching.
Python SDK patterns for Opik. Use when working in sdks/python, on SDK APIs, integrations, or message processing.