---
title: "OpenInference Trace Export"
description: "Export OpenInference traces to the Judgment platform."
sidebar:
  label: "OpenInference Integration"
seo:
  title: "OpenInference Trace Export to Judgment | Integration Docs"
  description: "Export OpenInference traces to Judgment so teams can inspect agent behavior, run judges, and monitor production regressions."
---

**OpenInference integration** sends traces from your OpenInference-instrumented applications to Judgment. If you're already using OpenInference for observability, this integration forwards those traces to Judgment without requiring additional instrumentation.

{/* @test-flow
  id: tracing-openinference
  lang: python
  env: JUDGMENT_API_KEY, JUDGMENT_ORG_ID, OPENAI_API_KEY
*/}

## Quickstart

1. ### Install Dependencies

    **uv**

    ```bash
    uv add openinference-instrumentation-openai judgeval openai
    ```

    **pip**

    ```bash
    pip install openinference-instrumentation-openai judgeval openai
    ```

2. ### Initialize Integration

    ```python title="setup.py"
    from judgeval import Tracer
    from openinference.instrumentation.openai import OpenAIInstrumentor

    Tracer.init(project_name="openinference_project")
    Tracer.registerOTELInstrumentation(OpenAIInstrumentor())
    ```

3. ### Add to Existing Code

    Add these lines to your existing OpenInference-instrumented application:

    ```python
    from openai import OpenAI
    from judgeval import Tracer  # [!code ++]
    from openinference.instrumentation.openai import OpenAIInstrumentor  # [!code ++]

    Tracer.init(project_name="openinference_project")  # [!code highlight]
    Tracer.registerOTELInstrumentation(OpenAIInstrumentor())  # [!code highlight]

    client = OpenAI()

    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[{"role": "user", "content": "Hello, world!"}]
    )

    print(response.choices[0].message.content)
    ```

    All OpenInference traces are exported to the Judgment platform.

## Example: Multi-Workflow Application

    > **Info**
    >
    > **Tracking Non-Instrumented Operations**: Use `@Tracer.observe()` to track any function or method that's not automatically captured by OpenInference instrumentors. The multi-workflow example below shows how `@Tracer.observe()` (highlighted) can be used to monitor custom logic and operations that happen outside your OpenInference-instrumented workflows.

```python title="multi_workflow_example.py"
from judgeval import Tracer
from openinference.instrumentation.openai import OpenAIInstrumentor
from openai import OpenAI

Tracer.init(project_name="openinference_project")
Tracer.registerOTELInstrumentation(OpenAIInstrumentor())

client = OpenAI()

def analyze_sentiment(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are a sentiment analysis expert."},
            {"role": "user", "content": f"Analyze the sentiment of: {text}"}
        ]
    )
    return response.choices[0].message.content

def extract_entities(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are an entity extraction expert."},
            {"role": "user", "content": f"Extract entities from: {text}"}
        ]
    )
    return response.choices[0].message.content

def summarize_text(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are a summarization expert."},
            {"role": "user", "content": f"Summarize: {text}"}
        ]
    )
    return response.choices[0].message.content

@Tracer.observe(span_type="function")  # [!code highlight]
def main():
    text = "Apple Inc. announced today that their new iPhone will be released next month. The market reacted positively to this news."

    sentiment = analyze_sentiment(text)
    entities = extract_entities(text)
    summary = summarize_text(text)

    print(f"Sentiment: {sentiment}")
    print(f"Entities: {entities}")
    print(f"Summary: {summary}")

if __name__ == "__main__":
    main()
```

## Available Instrumentors

OpenInference provides instrumentors for various frameworks and libraries:

### OpenAI

```python
from openinference.instrumentation.openai import OpenAIInstrumentor
Tracer.registerOTELInstrumentation(OpenAIInstrumentor())
```

### Anthropic

```python
from openinference.instrumentation.anthropic import AnthropicInstrumentor
Tracer.registerOTELInstrumentation(AnthropicInstrumentor())
```

### OpenAI Agents SDK

```python
from openinference.instrumentation.openai_agents import OpenAIAgentsInstrumentor
Tracer.registerOTELInstrumentation(OpenAIAgentsInstrumentor())
```

### LiteLLM

```python
from openinference.instrumentation.litellm import LiteLLMInstrumentor
Tracer.registerOTELInstrumentation(LiteLLMInstrumentor())
```

> **Tip**
>
> We recommend using the [OpenLLMetry LiteLLM instrumentor](/documentation/integrations/tracing-providers/openllmetry#litellm) as the preferred approach. See the [LiteLLM integration guide](/documentation/integrations/model-providers/litellm) for a full setup walkthrough.

### PydanticAI

```python
from openinference.instrumentation.pydanticai import PydanticAIInstrumentor
Tracer.registerOTELInstrumentation(PydanticAIInstrumentor())
```

### Other

> **Info**
>
> For a complete list of available instrumentors, visit the [OpenInference
> GitHub repository](https://github.com/Arize-ai/openinference).

## Next Steps

- [OpenAI Agents SDK](/documentation/integrations/agent-frameworks/openai-agents) - Trace OpenAI Agents SDK executions and handoffs.
- [Monitor a behavior](/documentation/monitoring) - Monitor your AI applications in production with behavioral scoring.
- [All Integrations](/documentation/integrations) - View the list of all integrations that Judgment supports.
