Skip to content

Commit b58e3f3

Browse files
adharshctrnirga
andauthored
feat(openai-agents): initial instrumentation; collect OpenAI agent traces and metrics (#2966)
Co-authored-by: Nir Gazit <[email protected]>
1 parent c3584ab commit b58e3f3

File tree

23 files changed

+5063
-155
lines changed

23 files changed

+5063
-155
lines changed

.cz.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ version_files = [
3838
"packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/version.py",
3939
"packages/opentelemetry-instrumentation-openai/pyproject.toml:^version",
4040
"packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/version.py",
41+
"packages/opentelemetry-instrumentation-openai-agents/pyproject.toml:^version",
42+
"packages/opentelemetry-instrumentation-openai-agents/opentelemetry/instrumentation/openai_agents/version.py",
4143
"packages/opentelemetry-instrumentation-pinecone/pyproject.toml:^version",
4244
"packages/opentelemetry-instrumentation-pinecone/opentelemetry/instrumentation/pinecone/version.py",
4345
"packages/opentelemetry-instrumentation-marqo/pyproject.toml:^version",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
__pycache__,
5+
build,
6+
dist,
7+
.tox,
8+
venv,
9+
.venv,
10+
.pytest_cache
11+
max-line-length = 120
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# OpenTelemetry OpenAI Agents Instrumentation
2+
3+
<a href="https://pypi.org/project/opentelemetry-instrumentation-openai-agents/">
4+
<img src="https://badge.fury.io/py/opentelemetry-instrumentation-openai-agents.svg">
5+
</a>
6+
7+
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.
8+
9+
## Installation
10+
11+
```bash
12+
pip install opentelemetry-instrumentation-openai-agents
13+
```
14+
15+
## Example usage
16+
17+
```python
18+
from opentelemetry.instrumentation.openai_agents import OpenAIAgentsInstrumentor
19+
20+
OpenAIAgentsInstrumentor().instrument()
21+
```
22+
23+
## Privacy
24+
25+
**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.
26+
27+
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.
28+
29+
To disable logging, set the `TRACELOOP_TRACE_CONTENT` environment variable to `false`.
30+
31+
```bash
32+
TRACELOOP_TRACE_CONTENT=false
33+
```

0 commit comments

Comments
 (0)