Skip to content

Integrations

ctxflow reads three conventions besides its own: OpenInference, OTel GenAI and OpenLLMetry. Instrumentation that emits them works as it is. The ctxflow SDK adds the identity (conversation and user) and what plain instrumentation does not give. What each path gives you:

Your app Turns, tools, tokens Retrieval and chunks delivered Match of retrieved items to your index
ctxflow SDK + any instrumentation in the same process yes yes by id and by text
Third-party instrumentation only, through the ctxflow collector yes yes by id, and by text when the text is sent
Third-party instrumentation only, directly to ctxflow yes yes by id, and by text when the text is sent

LlamaIndex has its own page: LlamaIndex (agents and workflows, retrievers, ingestion, MCP tools). In short: install ctxflow-otel[llamaindex] and start the app with ctxflow-instrument.

Install the OpenInference instrumentation and call it after ctxflow_otel.init():

Terminal window
pip install ctxflow-otel==0.2.2 openinference-instrumentation-langchain

(Where the package comes from: Install sources.)

import ctxflow_otel
from openinference.instrumentation.langchain import LangChainInstrumentor
provider = ctxflow_otel.init()
LangChainInstrumentor().instrument(tracer_provider=provider)

Or with no code: ctxflow-instrument python app.py loads every installed instrumentor.

The instrumentation creates the agent, retriever, tool and model spans with OpenInference attributes. You add:

  • identity: wrap each user turn in ctxflow_otel.conversation(...) (Identity);
  • source identity: the C1 keys in your document metadata (Source identity).

Keep one user turn per trace: the turn is the trace.

OpenLLMetry (Traceloop) and OTel GenAI instrumentation

Section titled “OpenLLMetry (Traceloop) and OTel GenAI instrumentation”

Model and tool spans of OpenLLMetry and OTel GenAI instrumentation are read as they are (gen_ai.operation.name, gen_ai.usage.*, gen_ai.tool.*, gen_ai.retrieval.documents). OpenLLMetry vector database spans are read for document ids (db.query.result.id, db.search.result.id). Retrieved items are read from OpenInference or OTel GenAI retrieval attributes only.

ctxflow reads the content these instrumentations capture. If you turn their content capture off (TRACELOOP_TRACE_CONTENT=false, OpenInference OPENINFERENCE_HIDE_*), ctxflow receives no text and the turn detail shows none.

ctxflow-otel[mcp] carries the conversation and the user to your MCP servers and records tool calls on both sides. Everything about it is on MCP servers and clients.

  • Node.js and TypeScript: the SDK @ctxflow/otel: JavaScript.
  • PHP: the SDK ctxflow/otel, with helpers for OpenAI PHP, Laravel Prism, LLPhant and Neuron AI: PHP.
  • Any other language: any OpenTelemetry SDK that exports OTLP/HTTP works. Send through the ctxflow collector or directly to ctxflow, use the OpenInference or OTel GenAI attributes and span kinds of the Agent turns page, and the ctxflow.* keys of the registry. Set session.id and user.id on your spans yourself.

ctxflow accepts OTLP/HTTP (protobuf or JSON). gRPC is accepted by the collector only. See OTLP endpoint.