skills/arize-instrumentation/SKILL.md
Adds Arize AX tracing to an LLM application for the first time. Follows a two-phase agent-assisted flow to analyze the codebase then implement instrumentation after user confirmation. Use when the user wants to instrument their app, add tracing from scratch, set up LLM observability, integrate OpenTelemetry or openinference, or get started with Arize tracing.
npx skillsauth add arize-ai/arize-skills arize-instrumentationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when the user wants to add Arize AX tracing to their application. Follow the two-phase, agent-assisted flow from the Agent-Assisted Tracing Setup and the Arize AX Tracing — Agent Setup Prompt.
If the user asks you to "set up tracing" or "instrument my app with Arize", you can start with:
Follow the instructions from https://arize.com/docs/PROMPT.md and ask me questions as needed.
Then execute the two phases below.
os.environ["ARIZE_API_KEY"], process.env.ARIZE_API_KEY). This includes API keys, space IDs, and any other secrets. The user sets these in their own environment; the agent must never output raw secret values.Before changing code:
ax will be needed for post-change verificationax installation or version. If ax is needed for verification later, just run it when the time comes. If it fails, see references/ax-profiles.md.If monorepo scope, service entrypoint, or target app is still unclear after quick inspection — or you would otherwise open with a bare list of questions — use this opening pattern:
skills/arize-instrumentation/SKILL.md if helpful).Do not write any code or create any files during this phase.
Check dependency manifests to detect stack:
pyproject.toml, requirements.txt, setup.py, Pipfilepackage.jsonpom.xml, build.gradle, build.gradle.ktsgo.modScan import statements in source files to confirm what is actually used.
Check for existing tracing/OTel — look for TracerProvider, register(), opentelemetry imports, ARIZE_*, OTEL_*, OTLP_* env vars, or other observability config (Datadog, Honeycomb, etc.).
Identify scope — for monorepos or multi-service projects, ask which service(s) to instrument.
| Item | Examples | |------|----------| | Language | Python, TypeScript/JavaScript, Java, Go | | Package manager | pip/poetry/uv, npm/pnpm/yarn, maven/gradle, go modules | | LLM providers | OpenAI, Anthropic, LiteLLM, Bedrock, etc. | | Frameworks | LangChain, LangGraph, LlamaIndex, Vercel AI SDK, Mastra, etc. | | Existing tracing | Any OTel or vendor setup | | Tool/function use | LLM tool use, function calling, or custom tools the app executes (e.g. in an agent loop) |
Key rule: When a framework is detected alongside an LLM provider, inspect the framework-specific tracing docs first and prefer the framework-native integration path when it already captures the model and tool spans you need. Add separate provider instrumentation only when the framework docs require it or when the framework-native integration leaves obvious gaps. If the app runs tools and the framework integration does not emit tool spans, add manual TOOL spans so each invocation appears with input/output (see references/manual-spans.md).
Return a concise summary:
If the user explicitly asked you to instrument the app now, and the target service is already clear, present the Phase 1 summary briefly and continue directly to Phase 2. If scope is ambiguous, or the user asked for analysis first, stop and wait for confirmation.
Use the Agent Setup Prompt routing table to map detected signals to integration docs and fetch the matched pages for exact installation steps and code snippets. Use llms.txt as a fallback for doc discovery.
See references/integration-routing.md for the full list of supported integrations by language and platform.
Proceed only after the user confirms the Phase 1 analysis.
pip install arize-otel plus openinference-instrumentation-{name} (hyphens in package name; underscores in import, e.g. openinference.instrumentation.llama_index).@opentelemetry/sdk-trace-node plus the relevant @arizeai/openinference-* package.openinference-instrumentation-* in pom.xml or build.gradle.arize-otel-go for tracer setup, plus a per-provider instrumentor when one exists. Install:
go get github.com/Arize-ai/arize-otel-go
go get github.com/Arize-ai/openinference/go/openinference-semantic-conventions
go get github.com/Arize-ai/openinference/go/openinference-instrumentation
# Plus exactly one of these, matched to the detected client:
go get github.com/Arize-ai/openinference/go/openinference-instrumentation-openai-go # official openai/openai-go SDK
go get github.com/Arize-ai/openinference/go/openinference-instrumentation-anthropic-sdk-go # anthropics/anthropic-sdk-go v1.43+
Wire the exporter with one call: arizeotel.Register(ctx, arizeotel.Options{ProjectName: "my-app"}) — defaults to otlp.arize.com (US), use arizeotel.EndpointArizeEurope for EU. It reads ARIZE_SPACE_ID / ARIZE_API_KEY / ARIZE_PROJECT_NAME / ARIZE_COLLECTOR_ENDPOINT from env when the matching Options fields are unset. Wire the OpenAI instrumentor by passing option.WithMiddleware(openaiotel.Middleware(otel.Tracer("my-app"))) to openai.NewClient(...) (alongside option.WithAPIKey(...)). Wire the Anthropic instrumentor by passing option.WithMiddleware(anthropicotel.Middleware(otel.Tracer("my-app"))) to anthropic.NewClient(...). Both instrumentors expose WithTraceConfig(instrumentation.TraceConfig{...}) for in-code overrides of the OPENINFERENCE_HIDE_* env-driven masking config. Module floor is Go 1.25 (the openinference Go modules require it; arize-otel-go itself is Go 1.23+).ax profiles for ARIZE_API_KEY and ARIZE_SPACE — never read .env files:
ax profiles show to check for an existing profile. Run ax profiles validate to verify an existing profile's credentials are still valid.ax profiles create which provides an interactive wizard that walks through API key and space setup. See CLI profiles docs for details.ax auth login. Inform users of this option if they prefer not to manage API keys — do not run ax auth login yourself as it opens a browser.os.environ["ARIZE_API_KEY"] / os.environ["ARIZE_SPACE"] (Python), process.env.ARIZE_API_KEY / process.env.ARIZE_SPACE (TypeScript/JavaScript), or os.Getenv("ARIZE_API_KEY") / os.Getenv("ARIZE_SPACE_ID") (Go — arize-otel-go reads ARIZE_SPACE_ID, not ARIZE_SPACE). With the recommended arizeotel.Register(ctx, arizeotel.Options{...}) flow, generated Go code does not need to call os.Getenv at all — Register reads both env vars when the matching Options fields are unset.instrumentation.py, instrumentation.ts, instrumentation.go) and initialize tracing before any LLM client is created.service.name alone is not accepted. Set it as a resource attribute on the TracerProvider (recommended — one place, applies to all spans):
register(project_name="my-app") handles it automatically (sets "openinference.project.name" on the resource). For routing spans to different projects, use set_routing_context(space_id=..., project_name=...) from arize.otel."model_id" (shown in the official TS quickstart) and "openinference.project.name" via SEMRESATTRS_PROJECT_NAME from @arizeai/openinference-semantic-conventions (shown in the manual instrumentation docs) — both work.arizeotel.Register(ctx, arizeotel.Options{ProjectName: "my-app"}) handles this automatically (sets openinference.project.name and service.name on the resource). If you're wiring sdktrace.NewTracerProvider directly (multi-exporter, on-prem collector), pass attribute.String("openinference.project.name", "my-app") to resource.New(...) manually.provider.shutdown() (TS) / provider.force_flush() then provider.shutdown() (Python) / tp.Shutdown(ctx) (Go) must be called before the process exits, otherwise async OTLP exports are dropped and no traces appear.Treat instrumentation as complete only when all of the following are true:
After implementation:
arize-trace skill to confirm traces arrived. If empty, retry shortly. Verify spans have expected openinference.span.kind, input.value/output.value, and parent-child relationships.ARIZE_SPACE and ARIZE_API_KEY, ensure tracer is initialized before instrumentors and clients, check connectivity to otlp.arize.com:443, and inspect app/runtime exporter logs so you can tell whether spans are being emitted locally but rejected remotely. For debug set GRPC_VERBOSITY=debug or pass log_to_console=True to register(). Common gotchas: (a) missing project name resource attribute causes HTTP 500 rejections — service.name alone is not enough; Python: pass project_name to register(); TypeScript: set "model_id" or SEMRESATTRS_PROJECT_NAME on the resource; Go: add attribute.String("openinference.project.name", "my-app") to resource.New(...); (b) CLI/script processes exit before OTLP exports flush — call provider.force_flush() then provider.shutdown() (Python/TS) or tp.Shutdown(ctx) (Go) before exit; (c) CLI-visible spaces/projects can disagree with a collector-targeted space ID — report the mismatch instead of silently rewriting credentials.input.value / output.value so tool calls and results are visible.When verification is blocked by CLI or account issues, end with a concrete status:
| Resource | URL | |----------|-----| | Agent-Assisted Tracing Setup | https://arize.com/docs/ax/alyx/tracing-assistant | | Agent Setup Prompt (full routing + phases) | https://arize.com/docs/PROMPT.md | | Arize AX Docs | https://arize.com/docs/ax | | Full integration list | https://arize.com/docs/ax/integrations | | Doc index (llms.txt) | https://arize.com/docs/llms.txt |
If the user asks about IDE-based instrumentation guidance or MCP setup, see references/tracing-assistant-mcp.md.
See references/ax-profiles.md § Save Credentials for Future Use.
data-ai
INVOKE THIS SKILL for Arize Prompt Hub and `ax prompts` workflows: author or import templates and save (Workflows A–B), label/promote (C), or list/get/edit/delete/duplicate (D). Use when the user mentions ax prompts, Prompt Hub, creating/editing/saving a prompt, `{variable}` placeholders, or production/staging labels. For improving prompt text using traces or eval scores, use arize-prompt-optimization. For running experiments, use arize-experiment.
tools
Manages Arize users, organizations, spaces, projects, roles, role bindings, resource restrictions, and API keys via the ax CLI. Use for enterprise admin workflows: inviting and offboarding users, onboarding new teams, creating custom roles for SAML/SSO mappings, assigning roles to users, restricting project-level access, and managing service keys for multi-tenant architectures. Covers ax users, ax organizations, ax spaces, ax projects, ax roles, ax role-bindings, and ax api-keys.
tools
Downloads, exports, and inspects existing Arize traces and spans to understand what an LLM app is doing or debug runtime issues. Covers exporting traces by ID, spans by ID, sessions by ID, and root-cause investigation using the ax CLI. Use when the user wants to look at existing trace data, see what their LLM app is doing, export traces, download spans, investigate errors, or analyze behavior regressions.
tools
Optimizes, improves, and debugs LLM prompts using production trace data, evaluations, and annotations. Extracts prompts from spans, gathers performance signal, and runs a data-driven optimization loop using the ax CLI. Use when the user mentions optimize prompt, improve prompt, make AI respond better, improve output quality, prompt engineering, prompt tuning, or system prompt improvement.