OpenTelemetry tracing for AI applications.
Trace LLM calls, agents, tools, and retrieval. Keep your application code and your observability stack.
79 integration families · 5 languages · OpenTelemetry-native · Apache 2.0
A real traced SDK guide assistant: five spans, 500 tokens, and server-computed cost. Capture and reproduction details.
- Start at the SDK boundary. Instrument supported clients and frameworks instead of adding logging around each call.
- Follow the request. Connect model calls, retrieval, and tool execution with OpenTelemetry spans and context.
- Choose what leaves your app. Configure content masking and export through your own OpenTelemetry pipeline.
Pick your language. These examples send traces to Future AGI; you can also supply your own OpenTelemetry tracer provider and exporter.
| Language | Instrumentation | Install / coordinates |
|---|---|---|
| Python | Framework instrumentors · Python 3.10–3.13 for this example | pip install fi-instrumentation-otel traceai-openai |
| TypeScript / JavaScript | Node.js instrumentors · OpenAI SDK 4 or 5 | npm install @traceai/fi-core @traceai/openai |
| Java | Client wrappers · Java 17+ | Maven: com.futureagi:traceai-java-openai:1.0.0 |
| Go | Middleware · Go 1.26+ for OpenAI | go get github.com/future-agi/traceAI/go/openai@latest |
| C# | Manual spans and activities · .NET 10 | dotnet add package fi-instrumentation-otel |
Set your credentials in the environment, not in source code. The OpenAI examples use OPENAI_MODEL; C# creates a manual span and needs only the Future AGI keys.
export FI_API_KEY="your-future-agi-api-key"
export FI_SECRET_KEY="your-future-agi-secret-key"
export OPENAI_API_KEY="your-openai-api-key"
export OPENAI_MODEL="gpt-4.1" # Choose a model available to your account.pip install fi-instrumentation-otel traceai-openaiSave as quickstart.py, then run python quickstart.py.
import os
from openai import OpenAI
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_openai import OpenAIInstrumentor
provider = register(project_name="traceai-quickstart", project_type=ProjectType.OBSERVE)
OpenAIInstrumentor().instrument(tracer_provider=provider)
try:
response = OpenAI().chat.completions.create(
model=os.environ["OPENAI_MODEL"],
messages=[{"role": "user", "content": "Say hello in one word."}],
)
print(response.choices[0].message.content)
finally:
provider.shutdown() # Flush pending spans before the process exits.Python SDK · OpenAI integration guide
Install, instrument, and make a traced OpenAI call
npm install @traceai/fi-core @traceai/openai @opentelemetry/instrumentation openai@5
npm install --save-dev tsx typescript @types/nodeSave as quickstart.ts, then run npx tsx quickstart.ts. The explicit patch below also works when ESM imports load OpenAI before the instrumentation hook.
import OpenAI from "openai";
import { register, ProjectType } from "@traceai/fi-core";
import { OpenAIInstrumentation } from "@traceai/openai";
import { registerInstrumentations } from "@opentelemetry/instrumentation";
const provider = register({
projectName: "traceai-quickstart",
projectType: ProjectType.OBSERVE,
});
const instrumentation = new OpenAIInstrumentation();
registerInstrumentations({ tracerProvider: provider, instrumentations: [instrumentation] });
instrumentation.manuallyInstrument(OpenAI); // Explicit patch for ESM imports.
async function main() {
try {
const response = await new OpenAI().chat.completions.create({
model: process.env.OPENAI_MODEL!,
messages: [{ role: "user", content: "Say hello in one word." }],
});
console.log(response.choices[0].message.content);
} finally {
await provider.shutdown();
}
}
main().catch((error) => { console.error(error); process.exitCode = 1; });For CommonJS, register the instrumentation before require("openai"); the module hook then patches it automatically. Use only one patching approach per application.
TypeScript SDK · OpenAI integration guide
Add the Maven dependencies and wrap your client
Add these dependencies to your pom.xml. The OpenAI client is a provided dependency, so include it explicitly.
<dependency>
<groupId>com.futureagi</groupId>
<artifactId>traceai-java-openai</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>0.8.0</version>
</dependency>Save this class as Quickstart.java in your Maven project's src/main/java directory. Compile with mvn compile and run it with your Java application's usual launcher. The explicit TraceConfig.baseUrl enables Cloud export; if you remove it, set FI_BASE_URL=https://api.futureagi.com in the environment instead. Separately, OPENAI_BASE_URL is optional and changes only the model API endpoint (OpenAI by default).
import ai.traceai.TraceAI;
import ai.traceai.TraceConfig;
import ai.traceai.openai.TracedOpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.ChatCompletionCreateParams;
import com.openai.models.ChatCompletionMessageParam;
import com.openai.models.ChatCompletionUserMessageParam;
public class Quickstart {
public static void main(String[] args) {
TraceAI.init(TraceConfig.builder()
.baseUrl("https://api.futureagi.com")
.apiKey(System.getenv("FI_API_KEY"))
.secretKey(System.getenv("FI_SECRET_KEY"))
.projectName("traceai-quickstart")
.build());
try {
var client = new TracedOpenAIClient(OpenAIOkHttpClient.builder()
.baseUrl(System.getenv().getOrDefault(
"OPENAI_BASE_URL", "https://api.openai.com/v1"))
.apiKey(System.getenv("OPENAI_API_KEY")).build());
var response = client.createChatCompletion(ChatCompletionCreateParams.builder()
.model(System.getenv("OPENAI_MODEL"))
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
ChatCompletionUserMessageParam.builder()
.role(ChatCompletionUserMessageParam.Role.USER)
.content(ChatCompletionUserMessageParam.Content.ofTextContent(
"Say hello in one word."))
.build()))
.build());
System.out.println(response.choices().get(0).message().content().orElse(""));
} finally {
TraceAI.shutdown();
}
}
}Java SDK and JitPack setup · OpenAI Java guide
Add middleware and a standard OTLP exporter
From a Go module (go mod init example.com/my-app for a new project):
go get github.com/future-agi/traceAI/go/openai@latest
go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@v1.47.0Save as main.go, run go mod tidy, then go run .. Future AGI's OTLP/HTTP endpoint needs both auth headers, the project resource attributes, and an uncompressed body.
package main
import (
"context"
"fmt"
"os"
traceaiopenai "github.com/future-agi/traceAI/go/openai"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/option"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)
func main() {
ctx := context.Background()
exporter, err := otlptracehttp.New(ctx,
otlptracehttp.WithEndpointURL("https://api.futureagi.com/tracer/v1/traces"),
otlptracehttp.WithHeaders(map[string]string{
"X-Api-Key": os.Getenv("FI_API_KEY"),
"X-Secret-Key": os.Getenv("FI_SECRET_KEY"),
}),
otlptracehttp.WithCompression(otlptracehttp.NoCompression),
)
if err != nil { panic(err) }
provider := sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exporter),
sdktrace.WithResource(resource.NewSchemaless(
attribute.String("project_name", "traceai-quickstart"),
attribute.String("project_type", "observe"),
)),
)
defer provider.Shutdown(ctx)
client := openai.NewClient(option.WithMiddleware(
traceaiopenai.Middleware(traceaiopenai.WithTracerProvider(provider)),
))
response, err := client.Chat.Completions.New(ctx, openai.ChatCompletionNewParams{
Model: os.Getenv("OPENAI_MODEL"),
Messages: []openai.ChatCompletionMessageParamUnion{
openai.UserMessage("Say hello in one word."),
},
})
if err != nil { panic(err) }
fmt.Println(response.Choices[0].Message.Content)
}OpenAI Go reference and examples · All Go integrations
Create a manual span in a .NET application
dotnet new console -n TraceAIQuickstart
cd TraceAIQuickstart
dotnet add package fi-instrumentation-otelReplace Program.cs with this example, then run dotnet run. C# provides explicit tracing APIs; it does not auto-patch the OpenAI client.
using FIInstrumentation;
using FIInstrumentation.Types;
var tracer = TraceAI.Register(options =>
{
options.ProjectName = "traceai-quickstart";
options.ProjectType = ProjectType.Observe;
});
try
{
var greeting = tracer.Chain("greet", span =>
{
span.SetInput("world");
var result = "Hello, world!";
span.SetOutput(result);
return result;
});
Console.WriteLine(greeting);
}
finally
{
TraceAI.Shutdown();
}C# source and tests · Tracing guide
After a call finishes, open the traceai-quickstart project in Observe in Future AGI. Flush or shut down the provider before a short-lived process exits.
79 integration families, with language coverage you can inspect. Each SDK link opens its package source. A dash means no dedicated framework package in this repository—not a promise of unsupported runtime behavior.
Python and TypeScript provide framework instrumentors; Java provides client wrappers and framework modules; Go provides middleware and framework integrations. C# provides manual spans and activities, not automatic framework instrumentation, so its framework cells are intentionally empty.
All 79 families are listed below, grouped by what they integrate. Runtime variants share a row: OpenAI includes Realtime; Google GenAI includes Live; AG2 includes its classic SDK. LangGraph ships in the LangChain integration. Shared SDKs are not counted as integrations. Package availability is not a claim of complete upstream feature compatibility; check each package's source and documentation for its scope.
Model providers · Agent frameworks · RAG & vector databases · Tools & search · Voice & realtime · Gateways & proxies · Coding agents · Java frameworks · Other
Hosted and local model inference, embeddings, and reranking.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | SDK | SDK | SDK | — | |
| SDK | SDK | SDK | SDK | — | |
| — | — | SDK | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK · Live | Legacy SDK only | SDK | SDK | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | — | — | — | |
| — | — | SDK | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK · Realtime | SDK | SDK | SDK | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — |
Agent orchestration, application frameworks, and agent-to-agent communication.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | — | — | SDK | — | |
| SDK · Classic | — | — | — | — | |
| SDK | — | — | — | — | |
| SDK | — | — | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — | |
| — | — | — | SDK | — | |
| — | SDK | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| — | SDK | — | — | — | |
| SDK | — | — | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — | |
| SDK | — | SDK | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — | |
| — | SDK | — | — | — | |
| — | SDK | — | — | — |
Retrieval pipelines, vector stores, and search backends.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| — | — | SDK | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | — | — | — | — | |
| SDK | — | — | — | — | |
| — | — | SDK | — | — | |
| SDK | — | — | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | SDK | — | — | |
| SDK | SDK | SDK | — | — |
Tool connectivity, web search, crawling, and extraction.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | — | — | — | — | |
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — | |
| SDK | — | — | — | — |
Voice-agent pipelines and conversations. OpenAI Realtime and Google GenAI Live are linked in their provider rows under Model providers.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | — | — | — |
Unified access and routing across model providers.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — |
In-process SDK integrations for coding-agent runs, sessions, and tools.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | SDK | — | — | — | |
| — | SDK | — | — | — | |
| — | SDK | — | — | — | |
| — | SDK | — | — | — |
Java application-framework integrations and auto-configuration.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| — | — | SDK | — | — | |
| — | — | SDK | — | — | |
| — | — | SDK | — | — |
LLM programming, structured output, validation, and evaluation.
| Integration | Python | TypeScript | Java | Go | C# |
|---|---|---|---|---|---|
| SDK | — | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | SDK | — | — | — | |
| SDK | — | — | — | — |
Bring existing telemetry: OpenInference · OpenLLMetry
Source indexes: Python packages · TypeScript packages · Java modules · Go modules · C# APIs
Counting method and manifest inventory · Regenerate with python3 .github/assets/generate-coverage.py (Python 3.11+).
Brand marks identify integrations, not partnerships or endorsements. A neutral package icon is used where no brand asset is bundled. Asset sources and licenses.
- Use your existing provider. Python and TypeScript instrumentors accept an OpenTelemetry tracer provider; Go middleware accepts one through
WithTracerProvider. The examples above configure Future AGI, not a mandatory export destination. - Keep standard transport. SDKs use OpenTelemetry span processing and OTLP exporters. With your own provider and exporter, configure the destination and authentication for your backend; Future AGI keys are only needed for Future AGI.
- Read the actual attributes. traceAI uses names such as
gen_ai.request.model,gen_ai.usage.input_tokens,input.value, andoutput.value, alongside its own span-kind and context fields. Coverage and attribute names vary by integration. These are not a claim of complete conformance to a particular revision of the evolving OTel GenAI specification.
Python attribute definitions · TypeScript semantic conventions · OpenAI Go capture contract
Content capture is enabled by default. Decide what may leave your application before you initialize instrumentation.
The following environment variables are implemented by the Python and TypeScript trace configuration:
| Variable | What it hides |
|---|---|
FI_HIDE_INPUTS=true |
Input values and input messages |
FI_HIDE_OUTPUTS=true |
Output values and output messages |
FI_HIDE_INPUT_MESSAGES=true |
Input message attributes |
FI_HIDE_OUTPUT_MESSAGES=true |
Output message attributes |
FI_HIDE_INPUT_TEXT=true / FI_HIDE_OUTPUT_TEXT=true |
Text inside input / output messages |
FI_HIDE_INPUT_IMAGES=true |
Images in input messages |
FI_HIDE_EMBEDDING_VECTORS=true |
Embedding vectors |
FI_HIDE_ERROR_DETAILS=true |
Error descriptions, exception messages, and stack traces |
For Python and TypeScript, when FI_HIDE_ERROR_DETAILS is unset, any input/output value, message, or text hide flag also turns on error-detail hiding. Explicit true or false overrides that derived value. Error status and error/exception types remain available.
Python configuration · TypeScript configuration · Go-specific controls · Java configuration · C# configuration
Configuration coverage differs across languages. Masking is not a guarantee that arbitrary user metadata, manually added attributes, or every provider-specific payload is free of sensitive data. Review the attributes your application exports.
Add an integration, improve an example, or bring a reproducible bug. Start with the contributing guide or open an issue.
traceAI is built by Future AGI and open-source contributors. For the platform that uses these traces for debugging and evaluation, see future-agi/future-agi.
License: Apache 2.0.
