Skip to content

feat(openai-agents): initial instrumentation; collect OpenAI agent traces and metrics #2966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6427318
Initialized the openai agent instrumentor
adharshctr May 28, 2025
6c5d8ac
Added the init and version file
adharshctr May 28, 2025
16fd549
Naming update
adharshctr May 28, 2025
e1846f1
Added instrumentation for openai agents
adharshctr May 29, 2025
a54e1c9
Added the lock file
adharshctr May 29, 2025
7b6deb0
Naming change
adharshctr May 29, 2025
aea78cc
Change naming
adharshctr May 29, 2025
4794b48
Naming change
adharshctr May 29, 2025
f045353
Added a sample app openai agent using litellm
adharshctr May 29, 2025
99fc730
Added the documentation
adharshctr May 29, 2025
25886d2
Added tests
adharshctr May 29, 2025
da48804
Upgraded the versions of openai agenst
adharshctr May 29, 2025
7213f73
Add litellm dependency
adharshctr May 29, 2025
91e0c4b
Added tests
adharshctr May 29, 2025
83787d9
Added tests
adharshctr May 29, 2025
dd58935
Done suggested change
adharshctr May 29, 2025
94b756f
Done suggested change
adharshctr May 29, 2025
a61e95f
Done suggested change
adharshctr May 30, 2025
0c4ebca
Done the suggested change
adharshctr May 30, 2025
45d5159
Done linting
adharshctr May 30, 2025
cbfbf2a
Refactor the code
adharshctr Jun 3, 2025
a8558d2
Added the tests
adharshctr Jun 5, 2025
b8d9c82
Added tests
adharshctr Jun 5, 2025
347dca8
Added the vcrpy dependency
adharshctr Jun 9, 2025
33e4b41
Updated the poetry
adharshctr Jun 9, 2025
bcf4ff4
Updated the dependencies
adharshctr Jun 9, 2025
20680b2
Used the agentic semantic conventions
adharshctr Jun 9, 2025
fd9035e
Used the agentic semantic conventions
adharshctr Jun 9, 2025
6d52258
Done code clean up
adharshctr Jun 10, 2025
73b274b
Updated the suggestion
adharshctr Jun 10, 2025
853fb1f
Updated the suggestion
adharshctr Jun 10, 2025
357d612
Updated the suggestion
adharshctr Jun 10, 2025
0ddeaf1
Updated the suggestion
adharshctr Jun 10, 2025
0ef5203
Recorded the tests
adharshctr Jun 12, 2025
dc4ffe7
Revert "Recorded the tests"
adharshctr Jun 12, 2025
fecb65c
recorded the tests
adharshctr Jun 12, 2025
c39998b
Added Histograms for token usage and duration
adharshctr Jun 25, 2025
8ee706b
Added the cassette yaml
adharshctr Jun 25, 2025
ab61c64
recorded the test
adharshctr Jun 26, 2025
3f2b637
recorded the test
adharshctr Jun 26, 2025
99f1050
recorded the test
adharshctr Jun 26, 2025
3bfa955
recorded the test
adharshctr Jun 26, 2025
4b4f954
recorded the test
adharshctr Jun 26, 2025
936f003
recorded the test
adharshctr Jun 26, 2025
de10094
Removed api key
adharshctr Jun 26, 2025
ce0b86f
Added tests with WatsonX
adharshctr Jun 28, 2025
9d5ad24
Added tests with WatsonX
adharshctr Jun 28, 2025
508f13d
Recorded the tests
adharshctr Jun 29, 2025
5727e52
Recorded the tests
adharshctr Jun 29, 2025
042d1da
Recorded the tests
adharshctr Jun 29, 2025
16e3929
Recorded the tests
adharshctr Jun 29, 2025
6d66754
Recorded the tests
adharshctr Jun 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/opentelemetry-instrumentation-openai_agents/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[flake8]
exclude =
.git,
__pycache__,
build,
dist,
.tox,
venv,
.venv,
.pytest_cache
max-line-length = 120
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
33 changes: 33 additions & 0 deletions packages/opentelemetry-instrumentation-openai_agents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# OpenTelemetry OpenAI Agents Instrumentation

<a href="https://pypi.org/project/opentelemetry-instrumentation-openai_agents/">
<img src="https://badge.fury.io/py/opentelemetry-instrumentation-openai_agents.svg">
</a>

This library enables tracing of agentic workflows implemented using the [OpenAI Agents framework](https://github.com/openai/openai-agents-python), allowing visibility into agent reasoning, tool usage, and decision-making steps.

## Installation

```bash
pip install opentelemetry-instrumentation-openai_agents
```

## Example usage

```python
from opentelemetry.instrumentation.openai_agents import OpenAIAgentsInstrumentor

OpenAIAgentsInstrumentor().instrument()
```

## Privacy

**By default, this instrumentation logs prompts, completions, and embeddings to span attributes**. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.

However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.

To disable logging, set the `TRACELOOP_TRACE_CONTENT` environment variable to `false`.

```bash
TRACELOOP_TRACE_CONTENT=false
```
Loading
Loading