OllamaInstrumentor
traces native Ollama chat calls, including messages, responses, tool calls, and
token counts, as OpenInference LLM spans in Arize AX.
Llama 3.2 + Ollama Tracing Tutorial (Google Colab)
Prerequisites
- Python 3.10+
- An Arize AX account (sign up)
- Ollama installed and running locally
- The
llama3.2:1bmodel pulled:ollama pull llama3.2:1b
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
ollama. In particular,
from ollama import chat captured before instrumentation is not traced.
Run Ollama
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
ollama-tracing-example. - You should see a new trace within ~30 seconds with a
ChatLLM span. - 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.
Troubleshooting
- No traces in Arize AX. Run
OllamaInstrumentor().instrument(...)before importing or callingollama. - Connection refused. Start the daemon with
ollama serveand confirm it responds athttp://localhost:11434. - Model not found. Pull it with
ollama pull llama3.2:1b. - No span for generate or embeddings. This instrumentor traces chat only;
generate,embed, andembeddingscalls are not supported.