Ollama Integration

Updated on Aug 14, 2026

Use this integration when your app is implemented in Python or .NET.

Setup

  1. Install SDK
bash
pip install progress-observability
  1. Instrument your app
python
Observability.instrument(
    app_name=os.getenv("OBSERVABILITY_APP_NAME"),
    api_key=os.getenv("OBSERVABILITY_API_KEY")
)
  1. Complete example
python
import os
from dotenv import load_dotenv

from ollama import Client
from progress.observability import Observability

load_dotenv()

Observability.instrument(
    app_name=os.getenv("OBSERVABILITY_APP_NAME"),
    api_key=os.getenv("OBSERVABILITY_API_KEY"),
)

model = os.getenv("OLLAMA_MODEL", "llama3.1:8b")
base_url = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434")

client = Client(host=base_url)

response = client.chat(
    model=model,
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the capital of France?"},
    ],
    options={"temperature": 0.0, "num_predict": 64},
)


Observability.shutdown()

To get a richer trace tree when building agents on top of this provider, use the @agent, @tool, @workflow, or @task decorators. See the Python SDK for details.

  1. Install SDK
bash
dotnet add package Progress.Observability.Instrumentation
  1. Instrument your app
cs
try
{
 chatClient = chatClient.AddObservability((options) =>
 {
 options.AppName = Environment.GetEnvironmentVariable("OBSERVABILITY_APP_NAME")!;
 options.ApiKey = Environment.GetEnvironmentVariable("OBSERVABILITY_API_KEY")!;
 });
 
 // Your code here.
}
finally
{
 // Call the Shutdown() method before exiting your agent to flush any remaining data.
 ObservabilityTracer.Shutdown();
}

To get a richer trace tree when building agents on top of this provider, use custom spans. See the .NET SDK for details.

In this article
Setup
Not finding the help you need?
Contact Support