Troubleshooting
Missing trajectories usually mean an unset API key, a process that exits before sending, or code running outside observe. The SDK reports each problem once on stderr and never stops your agent.
Troubleshooting
Nothing arrives.
zhanla: production tracing is off: set ZHANLA_API_KEY…on stderr: the key is not in the environment of the process that calledinit.zhanla: could not send trajectories (the export failed)on stderr, usually after an OpenTelemetry line such asFailed to export spans batch code: 401, reason: Unauthorized: the key is wrong, revoked, or rotated more than a day ago. Copy a current key from Settings → API Keys. A 400 means the agent id is not an agent of the key's organization. The SDK says this once per reason and never stops your agent.- The process was killed before the background send ran. A process that calls
os._exit, or is killed, loses what was waiting. A server that stops on a signal should callzhanla.flush()first. - A streamed reply that is never read to the end keeps its request open, so that request is never sent.
zhanla.init was called twiceraises: call it once per process.
Spans with no root. If your model calls arrive but there is no request around them, your code is not running inside an observed function. Each model call then becomes its own trajectory: there is no user message, no reply, and nothing that ties the calls of one request together. Put @zhanla.observe on the function that handles the request, and call the model from inside it.
A streamed reply recorded raw. If the reply shows as the raw body (for example {"token": "Hi"} lines) instead of its text, your stream is in a format the SDK does not read. Use server-sent events with one of the fields listed in Streaming replies (for example data: {"delta": "Hi"}), or have the observed function return the finished text. A list of JSON objects means the stream yields objects: yield text or bytes instead.
Troubleshooting
Nothing arrives.
zhanla: production tracing is off: set ZHANLA_API_KEY…on stderr: the key is not in the environment of the process that calledinit.zhanla: could not send trajectories (Unauthorized)on stderr: the key is wrong, revoked, or rotated more than a day ago. Copy a current key from Settings → API Keys.(Bad Request)means the agent id is not an agent of the key's organization. The SDK says this once per reason and never stops your agent.- The process was cut short before the background send ran. A process that calls
process.exit, or is killed, loses what was waiting. A server that stops on a signal shouldawait flush()first. - A streamed reply that is never read to the end keeps its request open, so that request is never sent.
- In a bundle, nothing is traced except what you name in
instrument(see below). zhanla.init was called twicethrows: call it once per process.
Spans with no root. If your model calls arrive but there is no request around them, your code is not running inside an observed function. Each model call then becomes its own trajectory: there is no user message, no reply, and nothing that ties the calls of one request together. Wrap the function that handles the request in observe, and call the model from inside it.
A streamed reply recorded raw. If the reply shows as the raw body (for example {"token":"Hi"} lines) instead of its text, your stream is in a format the SDK does not read. Use server-sent events with one of the fields listed in Streaming replies (for example data: {"delta":"Hi"}), or have the observed function return the finished text. A list of JSON objects means the stream yields objects: yield strings or bytes instead.
Updated Nov 24, 2026. Checked against release candidate b60cdc94. For AI agents: llms.txt.