Supported libraries
init traces the model clients and agent frameworks it finds in your project. Record anything else by hand.
What is traced on its own
init instruments the libraries installed in your environment and returns their names:
| library | name in init's return value |
|---|---|
| OpenAI | openai |
| Anthropic | anthropic |
| LangChain | langchain_core |
| LlamaIndex | llama_index |
| LiteLLM | litellm |
| CrewAI (Python 3.12 and earlier) | crewai |
| OpenAI Agents SDK | agents |
| Pydantic AI | pydantic_ai |
For anything else, record steps by hand:
@zhanla.observe / @zhanla.observe(name=...) | a span per call (sync or async) with its arguments and result |
with zhanla.span(name, kind=None): | a span of its own; kind="subagent" or "skill" says what it is |
zhanla.generation(model, input).end(output, input_tokens, output_tokens, thinking, thinking_tokens) | a model call |
zhanla.tool(name, arguments, mcp=None, kind=None).end(result) | a tool call; mcp="server" marks an MCP call |
Frameworks and their clients. When LangChain, LlamaIndex or CrewAI calls a model through a client that is also traced (OpenAI, Anthropic, LiteLLM), the call is recorded once, by the framework. Calls your own code makes on the client are always kept. Early builds of this SDK switched a client's instrumentor off whenever a framework that covers it was merely installed (OpenAI and Anthropic under LangChain or LlamaIndex, OpenAI and LiteLLM under CrewAI), and lost the calls your code made on the client directly. If init's return value lists the framework but not your client, upgrade zhanla.
A library that cannot be traced is reported once on stderr (zhanla: <library> will not be traced (…)) and left out of init's return value. Your agent still runs. To make that an error instead, name the library: zhanla.init(agent=…, instrument={"openai": openai}) raises if it cannot instrument it.
What is traced on its own
init instruments the libraries installed in your project's own node_modules (looked up from the working directory, so start your app from its project folder) and resolves to their names:
| library | name in init's result |
|---|---|
OpenAI (openai) | openai |
Anthropic (@anthropic-ai/sdk) | @anthropic-ai/sdk |
LangChain (@langchain/core) | @langchain/core/callbacks/manager |
LlamaIndex (llamaindex) | llamaindex |
OpenAI Agents SDK (@openai/agents) | @openai/agents |
AI SDK 7 and later (ai) | ai |
ES-module and CommonJS code are both traced. For anything else, record steps by hand:
observe(fn, { name }) | a span per call with its arguments and result; a returned stream keeps it open until consumed |
span(name, fn, mark?) | a span of its own; "subagent", "skill" or { mcp: "server" } say what it is |
generation(model, input).end(output, inputTokens, outputTokens, thinking, thinkingTokens) | a model call |
tool(name, args, mark?).end(result) | a tool call |
Frameworks and their clients. When LangChain or LlamaIndex calls a model through the OpenAI or Anthropic client, the call is recorded once, by the framework. Calls your own code makes on the client are always kept. Early builds of this SDK switched the OpenAI and Anthropic instrumentors off whenever LangChain or LlamaIndex was merely installed, and lost the calls your code made on the client directly. If init's result lists the framework but not your client, upgrade @zhanla/sdk.
A library that cannot be traced is reported once on stderr (zhanla: <library> will not be traced (…)) and left out of init's result. Your agent still runs. One known case: in a pnpm workspace with hoist=false, the OpenAI instrumentor cannot load openai, because it does not declare it as a dependency. Keep pnpm's default hoisting, or declare the peer in your root package.json:
{ "pnpm": { "packageExtensions": { "@arizeai/openinference-instrumentation-openai": { "peerDependencies": { "openai": "*" } } } } }To make a library that cannot be traced an error instead, name it in instrument (see Bundles).
Updated Nov 24, 2026. Checked against release candidate b60cdc94. For AI agents: llms.txt.