systemOne API, returning answers whose TypeScript types are inferred from the questions you ask. Arize AX captures every call through the @arizeai/openinference-instrumentation-typesafe instrumentor, which emits one OpenInference LLM span per TypeSafeClient.systemOne call with the request and answers as JSON, the resolved model, and token usage.
This is the TypeScript / JavaScript guide. For the Python instrumentor, see TypeSafe AI.
client.models.list() is not instrumented — only systemOne produces spans. SDK retries are folded into one span rather than emitting a span per attempt.Prerequisites
- Node.js 20+
@typesafe-ai/sdk0.6.0 or newer — the range the instrumentor patches- An Arize AX account (sign up)
- A
TYPESAFE_API_KEYfrom TypeSafe AI
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
Configure credentials
Setup tracing
Register aNodeTracerProvider that ships spans to Arize AX, then hand it to TypeSafeInstrumentation and patch the SDK with manuallyInstrument.
manuallyInstrument(TypeSafe) patches TypeSafeClient.prototype, so it covers ESM, bundlers, and modules imported before the instrumentor was enabled — import instrumentation.ts first and the rest of your code can keep importing TypeSafeClient normally. On CommonJS you can instead let Node’s require hook patch the SDK, by installing @opentelemetry/instrumentation and passing the instrumentor to its registerInstrumentations({ instrumentations: [instrumentation] }) in place of the manuallyInstrument call. That path only works when instrumentation.ts runs before the SDK is required, which is why the snippet above uses manuallyInstrument.Run TypeSafe AI
npx tsx example.ts. The instrumented systemOne still returns an SDK APIPromise, so await, withResponse(), and map() behave exactly as they do without tracing.
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
typesafe-tracing-example. - You should see a new trace within ~30 seconds containing a single
TypeSafeClient.systemOneLLM span. Its input is the JSON request (stateplusquestions), its output is the JSON result (model,answers,usage), and it carriesllm.request.model_name(jev-latest, which this instrumentor fills in from the client default when the call omitsmodel),llm.response.model_name(the resolved version, for examplejev-1.13.0), and prompt, completion, and total token counts. - If no traces appear, see Troubleshooting.
Check from the skill, CLI, or SDK
Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.- Arize skill (agent)
- AX CLI
- SDK
Install the Arize Skills plugin and let your coding agent check for you:Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.
Mask sensitive payloads
The requeststate is the document you are asking about, so it often carries customer data. Pass traceConfig to drop inputs, outputs, or both before the span leaves your process:
Troubleshooting
- No traces in Arize AX. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsexample.ts. Enable OpenTelemetry debug logs withexport OTEL_LOG_LEVEL=debugand re-run. - Spans missing but
systemOnereturns answers.manuallyInstrument(TypeSafe)must run before the firstsystemOnecall, soinstrumentation.tshas to be imported before any code that calls the SDK. - No span for
models.list(). Expected — the instrumentor only wrapssystemOne. 401from TypeSafe. VerifyTYPESAFE_API_KEYis set and valid; the client reads it from the environment unless you passapiKeyexplicitly.- SDK fails to install or import. The TypeSafe SDK requires Node.js 20+. Check with
node --version. - Process exits before spans flush. Spans are exported asynchronously; always
await provider.forceFlush()(orprovider.shutdown()) before the process exits.