LlamaIndex Integration

Updated on Aug 14, 2026

Use this integration when your LlamaIndex application is implemented in Python or TypeScript.

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
import asyncio
from dotenv import load_dotenv
from llama_index.core.agent import FunctionAgent
from llama_index.core.tools import FunctionTool
from llama_index.llms.openai import OpenAI
from progress.observability import Observability

load_dotenv()

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

def get_weather(location: str) -> str:
  """Get the weather for a given location."""
  return f"The weather in {location} is cloudy with a high of 15°C."

async def main() -> None:
  agent = FunctionAgent(
    tools=[FunctionTool.from_defaults(fn=get_weather)],
    llm=OpenAI(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4.1-mini"),
    verbose=False,
    streaming=False,
    allow_parallel_tool_calls=False,
    system_prompt="You are a helpful AI assistant.",
  )
  response = await agent.run("What's the weather in Paris?")

if __name__ == "__main__":
 asyncio.run(main())
  1. Install SDK
bash
npm install @progress/observability
  1. Instrument your app
TS
import '@progress/observability/register/hooks';
import { Observability } from '@progress/observability';
await Observability.instrument({
  appName: process.env.OBSERVABILITY_APP_NAME,
  apiKey: process.env.OBSERVABILITY_API_KEY
});
  1. Complete example
TS
import '@progress/observability/register/hooks';
import 'dotenv/config';

import { FunctionTool } from 'llamaindex';
import { OpenAIAgent, openai } from '@llamaindex/openai';
import { Observability } from '@progress/observability';

function getWeather({ location }: { location: string }): string {
  return `The weather in ${location} is cloudy with a high of 15°C.`;
}

async function main() {
  await Observability.instrument({
    appName: process.env.OBSERVABILITY_APP_NAME,
    apiKey: process.env.OBSERVABILITY_API_KEY,
  });

  try {
    const weatherTool = new FunctionTool(getWeather, {
      name: 'get_weather',
      description: 'Get the weather for a given location.',
      parameters: {
        type: 'object',
        properties: { location: { type: 'string' } },
        required: ['location'],
      },
    });

    const agentRunner = new OpenAIAgent({
      llm: openai({ model: process.env.OPENAI_MODEL ?? 'gpt-4o-mini' }),
      tools: [weatherTool],
    });

    const response = await agentRunner.chat({ message: "What's the weather in Paris?" });
    console.log(String(response));
  } finally {
    await Observability.shutdown();
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
In this article
Setup
Not finding the help you need?
Contact Support