Skip to content

Commit a128101

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 a128101

9 files changed

Lines changed: 2034 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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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), with token usage and cost
12+
- **Tool spans** — the Browserbase `load_page` call, with the URL in and page text out
13+
- **Chain span** — groups the whole agent run; token usage and cost roll up to the trace
14+
15+
## Setup
16+
17+
Requires **Node.js 18.19+** (or 20.6+) — the OpenTelemetry dependencies set this baseline.
18+
19+
```bash
20+
npm install
21+
cp .env.example .env # then fill in your keys
22+
```
23+
24+
| Variable | Where to find it |
25+
| ------------------------ | ------------------------------------------------ |
26+
| `ARIZE_SPACE_ID` | Arize AX → Space Settings |
27+
| `ARIZE_API_KEY` | Arize AX → Space Settings |
28+
| `ARIZE_PROJECT_NAME` | Any name; groups traces in AX (optional) |
29+
| `BROWSERBASE_API_KEY` | [Browserbase dashboard](https://browserbase.com) |
30+
| `BROWSERBASE_PROJECT_ID` | Browserbase dashboard |
31+
| `OPENAI_API_KEY` | OpenAI dashboard |
32+
33+
## Run
34+
35+
```bash
36+
npm start
37+
# or ask your own question:
38+
npm start "Read https://docs.browserbase.com and list the main products."
39+
```
40+
41+
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.
42+
43+
## Files
44+
45+
- [`src/instrumentation.ts`](src/instrumentation.ts) — Arize AX / OpenTelemetry setup (OTLP exporter, OpenAI instrumentation). Must be imported before `openai`.
46+
- [`src/agent.ts`](src/agent.ts) — the tool-calling agent: a loop over the Browserbase `load_page` tool, with manual `CHAIN` and `TOOL` spans.
47+
48+
## Optional: register the tool in the Prompt Hub
49+
50+
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):
51+
52+
```bash
53+
npm run register-prompt
54+
```
55+
56+
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.
57+
58+
---
59+
60+
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)