Musterby Elitery
Integrations

LlamaIndex Workflows

Trace LlamaIndex Workflows in Muster via the OpenInference instrumentation.

LlamaIndex Workflows is an event-driven framework using the @step decorator to orchestrate complex AI processes — agent collaboration, RAG flows, data extraction. Muster captures Workflow runs through the same OpenInference LlamaIndex instrumentation.

Setup

1. Install dependencies

%pip install langfuse openai llama-index-workflows llama-index-core llama-index-llms-openai openinference-instrumentation-llama_index llama-index-instrumentation

2. Configure credentials

import os

os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["OPENAI_API_KEY"] = "sk-proj-..."
from langfuse import get_client

langfuse = get_client()

if langfuse.auth_check():
    print("Muster client is authenticated and ready!")

3. Initialize instrumentation

from openinference.instrumentation.llama_index import LlamaIndexInstrumentor

LlamaIndexInstrumentor().instrument()

4. Run a workflow

from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from typing import Annotated

from workflows import Workflow, step
from workflows.events import StartEvent, StopEvent
from workflows.resource import Resource


def get_llm(**kwargs):
    return OpenAI(model="gpt-4.1-mini")


class MyWorkflow(Workflow):
    @step
    async def step1(
        self, ev: StartEvent, llm: Annotated[OpenAI, Resource(get_llm)]
    ) -> StopEvent:
        msg = ChatMessage(role="user", content=ev.get("input"))
        response = await llm.achat([msg])
        return StopEvent(result=response.message.content)


w = MyWorkflow()
response = await w.run(input="Hello, what is Muster?")
print(response)

5. View traces

LlamaIndex Workflows trace example

See also