Skip to content

Commit dda9851

Browse files
committed
feat(arize): add Browserbase × Arize AX integration
Use Browserbase as a load_page tool for a tool-calling agent, traced end to end with Arize AX via OpenTelemetry + OpenInference. The model calls the Browserbase tool to browse a page and answer; the run is exported to AX as a CHAIN → LLM → TOOL trace with tokens and cost. - src/agent.ts: tool-calling agent with manual CHAIN/TOOL spans - src/instrumentation.ts: Arize AX / OTel setup + OpenAI auto-instrumentation - src/register-prompt.ts: optional — publish the load_page tool to the AX Prompt Hub via @arizeai/ax-client Verified end to end against live Arize AX, Browserbase, and OpenAI.
1 parent e4a3844 commit dda9851

9 files changed

Lines changed: 2328 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ integrations/
2424
│ └── integrations/
2525
│ ├── agentkit/ # AgentKit implementations
2626
│ ├── agno/ # Agno agent framework integration
27+
│ ├── arize/ # Arize AX observability & tracing
2728
│ ├── braintrust/ # Evaluation and testing tools
2829
│ ├── browser-use/ # Browser Use automation
2930
│ ├── cartesia/ # Cartesia integration
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Arize AX credentials (Space Settings → copy Space ID and API Key)
2+
ARIZE_SPACE_ID=
3+
ARIZE_API_KEY=
4+
ARIZE_PROJECT_NAME=browserbase-arize-agent
5+
6+
# Browserbase credentials
7+
BROWSERBASE_API_KEY=
8+
BROWSERBASE_PROJECT_ID=
9+
10+
# OpenAI (drives the agent)
11+
OPENAI_API_KEY=
12+
OPENAI_MODEL=gpt-5.4 # optional, defaults to gpt-5.4
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Arize AX Integration
2+
3+
Use Browserbase as a **tool** for an agent, and trace every tool call with [Arize AX](https://arize.com/docs/ax).
4+
5+
## Overview
6+
7+
This integration makes Browserbase a **tool** an agent can call — here a `load_page` tool that browses the web. The agent uses tool calling to perform a task (e.g. read a page and summarize it), and **Arize AX traces the whole run** so you can debug, monitor, and evaluate it.
8+
9+
Arize AX is an observability and evaluation platform for AI applications. It ingests [OpenTelemetry](https://opentelemetry.io/) traces via [OpenInference](https://github.com/Arize-ai/openinference), so each part of the agent shows up as a span:
10+
11+
- **LLM spans** — every OpenAI chat completion (captured automatically)
12+
- **Tool spans** — the Browserbase `load_page` call, with the URL in and page text out
13+
- **Chain span** — the whole agent run, with tokens and cost attributed
14+
15+
## Setup
16+
17+
```bash
18+
npm install
19+
cp .env.example .env # then fill in your keys
20+
```
21+
22+
| Variable | Where to find it |
23+
| ------------------------ | ------------------------------------------------ |
24+
| `ARIZE_SPACE_ID` | Arize AX → Space Settings |
25+
| `ARIZE_API_KEY` | Arize AX → Space Settings |
26+
| `ARIZE_PROJECT_NAME` | Any name; groups traces in AX (optional) |
27+
| `BROWSERBASE_API_KEY` | [Browserbase dashboard](https://browserbase.com) |
28+
| `BROWSERBASE_PROJECT_ID` | Browserbase dashboard |
29+
| `OPENAI_API_KEY` | OpenAI dashboard |
30+
31+
## Run
32+
33+
```bash
34+
npm start
35+
# or ask your own question:
36+
npm start "Read https://docs.browserbase.com and list the main products."
37+
```
38+
39+
The agent browses with Browserbase, prints an answer, and the trace appears in your Arize AX project as a `CHAIN → LLM → TOOL(load_page)` tree.
40+
41+
## Files
42+
43+
- [`src/instrumentation.ts`](src/instrumentation.ts) — Arize AX / OpenTelemetry setup (OTLP exporter, OpenAI instrumentation). Must be imported before `openai`.
44+
- [`src/agent.ts`](src/agent.ts) — the tool-calling agent: a loop over the Browserbase `load_page` tool, with manual `CHAIN` and `TOOL` spans.
45+
46+
## Optional: register the tool in the Prompt Hub
47+
48+
To also publish the `load_page` tool as a prompt in the Arize AX Prompt Hub (so you can iterate on prompting + tool calling there):
49+
50+
```bash
51+
npm run register-prompt
52+
```
53+
54+
This uses [`@arizeai/ax-client`](https://www.npmjs.com/package/@arizeai/ax-client) to create a `browserbase-load-page` prompt carrying the tool schema. AX stores the schema; `agent.ts` is what executes the tool.
55+
56+
---
57+
58+
You've integrated Browserbase with Arize AX! Use Browserbase as a tool to build composable agents that perform tasks like data extraction and RAG — and let Arize AX trace and evaluate every prompt, tool call, and token.

0 commit comments

Comments
 (0)