We recommend starting with the auto-instrumentation first. For advanced customization and granular control, you can directly utilize our OTEL-compliant instrumentation API.

1. Tracing Integrations: Quick Start (Auto-Instrumentation)

Implement trace logging effortlessly with our pre-built tracing integrations. These integrations offer flexibility for further customization as needed.

LLM ModelsOrchestration FrameworksOther
OpenAILlamaIndexDSPY
Vertex AI (Gemini)Langchain
AWS BedrockHaystack
Mistral AILiteLLM
AnthropicCrewAI
Groq

2. Manual Instrumentation

For applications requiring precise control over trace data, Future AGI provides OpenTelemetry (OTEL) support. This enables custom span creation and modification using the OpenTelemetry Trace API.

Implementation Guide (Python)

Step 1: System Requirements

Prerequisites:

pip install fi-instrumentation-otel
pip install traceAI-openai

Step 2: Set Environment Variables

import os
os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"

Step 3: Configuring a Tracer

Setting up an OTEL tracer typically requires complex boilerplate code. Future AGI simplifies this process with our register helper function:

from traceai_openai import OpenAIInstrumentor
from fi_instrumentation import register

# Initialize OTel using our register function
trace_provider = register(
    project_type=ProjectType.EXPERIMENT,
    project_name="FUTURE_AGI",
    project_version_name="openai-exp",
)

Step 4: Span Implementation

When using our Auto-Instrumenters, span creation is handled automatically. You can further customize these spans as needed.

OpenAIInstrumentor().instrument(tracer_provider=trace_provider)

For complete control over spans you can use manual instrumentation:

from opentelemetry import trace

trace.set_tracer_provider(trace_provider)
tracer = trace.get_tracer(__name__)

Next we create spans by starting spans and defining our name and other attributes:

def process_operation():
    with tracer.start_as_current_span("span-name") as span:
        # Execute operations tracked by 'span'
        print("doing some work...")
        # When the 'with' block goes out of scope, 'span' is automatically closed

You can also use start_span to create a span without making it the current span. This is usually done to track concurrent or asynchronous operations.

Implementing Nested Spans

Track sub-operations within larger operations by creating hierarchical span relationships:

def process_operation():
    with tracer.start_as_current_span("parent") as parent:
        # Execute parent-level operations
        print("doing some work...")
        # Create nested span for sub-operations
        with tracer.start_as_current_span("child") as child:
            # Execute child-level operations
            print("doing some nested work...")
            # Child span closes automatically when it's out of scope

In our platform child span appears as a nested component under the parent span.

Decorator Implementation

@tracer.start_as_current_span("process_operation")
def process_operation():
    print("doing some work...")

Use of the decorator is equivalent to creating the span inside process_operation() and ending it when process_operation() is finished.

To use the decorator, you must have a tracer instance in scope for your function declaration.