Skip to content

Commit c8d510c

Browse files
docs: update tracing example and description for non-OpenAI models
1 parent 25a6f28 commit c8d510c

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

docs/tracing.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ By default, the SDK traces the following:
3939
- Audio outputs (text-to-speech) are wrapped in a `speech_span()`
4040
- Related audio spans may be parented under a `speech_group_span()`
4141

42-
By default, the trace is named "Agent trace". You can set this name if you use `trace`, or you can can configure the name and other properties with the [`RunConfig`][agents.run.RunConfig].
42+
By default, the trace is named "Agent workflow". You can set this name if you use `trace`, or you can configure the name and other properties with the [`RunConfig`][agents.run.RunConfig].
4343

4444
In addition, you can set up [custom trace processors](#custom-tracing-processors) to push traces to other destinations (as a replacement, or secondary destination).
4545

@@ -98,37 +98,28 @@ To customize this default setup, to send traces to alternative or additional bac
9898
2. [`set_trace_processors()`][agents.tracing.set_trace_processors] lets you **replace** the default processors with your own trace processors. This means traces will not be sent to the OpenAI backend unless you include a `TracingProcessor` that does so.
9999

100100

101-
## Tracing with Non-OpenAI LLMs
101+
## Tracing with Non-OpenAI Models
102102

103-
You can use an OpenAI API key with non-OpenAI LLMs to enable free tracing on the Openai Traces dashboard without disabling tracing.
103+
You can use an OpenAI API key with non-OpenAI Models to enable free tracing in the OpenAI Traces dashboard without needing to disable tracing.
104104

105105
```python
106-
from agents import set_tracing_export_api_key, Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
107-
from dotenv import load_dotenv
108-
load_dotenv()
109-
import os
106+
from agents import set_tracing_export_api_key, Agent, Runner
107+
from agents.extensions.models.litellm_model import LitellmModel
110108

111-
set_tracing_export_api_key(os.getenv("OPENAI_API_KEY"))
112-
gemini_api_key = os.getenv("GEMINI_API_KEY")
109+
set_tracing_export_api_key("OPENAI_API_KEY")
113110

114-
external_client = AsyncOpenAI(
115-
api_key=gemini_api_key,
116-
base_url="https://generativelanguage.googleapis.com/v1beta"
117-
)
118-
119-
model = OpenAIChatCompletionsModel(
120-
model="gemini-2.0-flash",
121-
openai_client=external_client,
122-
)
111+
model = LitellmModel(
112+
model="your-model-name",
113+
api_key="your-api-key",
114+
)
123115

124116
agent = Agent(
125117
name="Assistant",
126118
model=model,
127-
)
119+
)
128120
```
129121

130122
## Notes
131-
- Set OPENAI_API_KEY in a .env file.
132123
- View free traces at Openai Traces dashboard.
133124

134125

@@ -152,3 +143,4 @@ agent = Agent(
152143
- [Okahu-Monocle](https://github.com/monocle2ai/monocle)
153144
- [Galileo](https://v2docs.galileo.ai/integrations/openai-agent-integration#openai-agent-integration)
154145
- [Portkey AI](https://portkey.ai/docs/integrations/agents/openai-agents)
146+
- [LangDB AI](https://docs.langdb.ai/getting-started/working-with-agent-frameworks/working-with-openai-agents-sdk)

0 commit comments

Comments
 (0)