Skip to content

Commit 74001f2

Browse files
authored
Some fixes to the openai agents readme (#1391)
* Some fixes to the openai agents readme * Some fixes to the openai agents readme
1 parent 83738c3 commit 74001f2

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

temporalio/contrib/openai_agents/README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# OpenAI Agents SDK Integration for Temporal
22

3-
⚠️ **Public Preview** - The interface to this module is subject to change prior to General Availability.
43
We welcome questions and feedback in the [#python-sdk](https://temporalio.slack.com/archives/CTT84RS0P) Slack channel at [temporalio.slack.com](https://temporalio.slack.com/).
54

65
## Introduction
@@ -538,29 +537,30 @@ SQLite storage is not suited to a distributed environment.
538537

539538
## OpenTelemetry Integration
540539

540+
⚠️ **Public Preview** - This functionality is subject to change prior to General Availability.
541+
541542
This integration provides seamless export of OpenAI agent telemetry to OpenTelemetry (OTEL) endpoints for observability and monitoring. The integration automatically handles workflow replay semantics, ensuring spans are only exported when workflows actually complete.
542543

543544
### Quick Start
544545

545546
To enable OTEL telemetry export, you need to set up a global `ReplaySafeTracerProvider` and enable the integration in the `OpenAIAgentsPlugin`:
546547

547548
```python
548-
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
549+
from datetime import timedelta
550+
from temporalio.client import Client
551+
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin, ModelActivityParameters
549552
from temporalio.contrib.opentelemetry import create_tracer_provider
550553
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
551554
from opentelemetry import trace
555+
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
552556

553557
# Configure your OTEL exporters
554-
exporters = [
555-
OTLPSpanExporter(endpoint="http://localhost:4317"),
556-
# Add multiple exporters for different endpoints as needed
557-
]
558558

559559
# Set up the global tracer provider
560-
tracer_provider = create_tracer_provider(exporters=exporters)
560+
tracer_provider = create_tracer_provider()
561+
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4317")))
561562
trace.set_tracer_provider(tracer_provider)
562563

563-
# For production applications
564564
client = await Client.connect(
565565
"localhost:7233",
566566
plugins=[
@@ -572,15 +572,6 @@ client = await Client.connect(
572572
),
573573
],
574574
)
575-
576-
# For testing
577-
from temporalio.contrib.openai_agents.testing import AgentEnvironment
578-
579-
async with AgentEnvironment(
580-
model=my_test_model,
581-
use_otel_instrumentation=True # Enable OTEL integration for tests
582-
) as env:
583-
client = env.applied_on_client(base_client)
584575
```
585576

586577
### Features

0 commit comments

Comments
 (0)