> ## Documentation Index
> Fetch the complete documentation index at: https://futureagi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Agents

## 1. Installation

First install the traceAI package to access the observability framework

```bash theme={null}
pip install traceAI-openai-agents
```

***

## 2. Set Environment Variables

Set up your environment variables to authenticate with both FutureAGI and OpenAI.

```python theme={null}
import os

os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"
```

***

## 3. Initialize Trace Provider

Set up the trace provider to create a new project in FutureAGI, establish telemetry data pipelines .

```python theme={null}
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.EXPERIMENT,
    project_name="openai_project",
)
```

***

## 4. Instrument your Project

Instrument your Project with OpenAI Agents Instrumentor. This step ensures that all interactions with the OpenAI are tracked and monitored.

```python theme={null}
from traceai_openai_agents import OpenAIAgentsInstrumentor

OpenAIAgentsInstrumentor().instrument(tracer_provider=trace_provider)
```

***

## 5. Interact with OpenAI Agents

Interact with the OpenAI Agents as you normally would. Our Instrumentor will automatically trace and send the telemetry data to our platform.

```python theme={null}
from agents import Agent, Runner

agent = Agent(name="Assistant", instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")

print(result.final_output)
```
