File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ # Lab 18: Observability
2+
3+ In this lab, we will integrate the OpenAI Agents SDK with Braintrust Observability tool
4+
5+ ## Sign up for Braintrust
6+
7+ 1 . Sign up for Braintrust free plan - https://www.braintrust.dev/pricing
8+ 1 . You will be asked to create an organisation. Create one in your name
9+ 1 . After sign up it will ask if you want to add tracing for an existing application. Select that option and it will show you your API key. Copy it.
10+ 1 . Rename the default project to "Prodapt"
11+
12+ ## Configure the app
13+
14+ 1 . To the ` .env ` file add ` BRAINTRUST_API_KEY=... `
15+ 1 . Update ` config.py ` and add the setting ` BRAINTRUST_API_KEY: str `
16+ 1 . Open ` agent.py `
17+
18+ Add these imports
19+
20+ ``` python
21+ from agents import set_trace_processors
22+ from braintrust import init_logger
23+ from braintrust.wrappers.openai import BraintrustTracingProcessor
24+ ```
25+
26+ The in the ` main() ` function configure the tracing. (Assuming that the name of the project in Braintrust is "Prodapt")
27+
28+ ``` python
29+ set_trace_processors([BraintrustTracingProcessor(init_logger(" Prodapt" , api_key = settings.BRAINTRUST_API_KEY ))])
30+ ```
31+
32+ Run the agents app and see the traces in the UI
You can’t perform that action at this time.
0 commit comments