Skip to content

Commit 709a780

Browse files
committed
Added instructions for lab 18
1 parent d1ed6d4 commit 709a780

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

labs/18-observability.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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

0 commit comments

Comments
 (0)