examples/ has 01-http-curl.sh, 02-otel.mjs and 03-mcp.mjs, but nothing for the Vercel AI SDK (ai package), which is one of the most common ways people build TS/JS agents.
Task
Add examples/04-vercel-ai-sdk.mjs that:
- Makes a
generateText / streamText call with the Vercel AI SDK.
- Emits a Lookspan span for it — either via the OpenAI drop-in (
@lookspan/openai) under the hood, or by POSTing a span to http://127.0.0.1:3100/api/ingest (see the curl example for the payload shape).
- Prints the trace URL so the user can open it.
Where
- New file under
examples/, mirroring the style of examples/02-otel.mjs.
- Add a line to
examples/README.md.
Acceptance
node examples/04-vercel-ai-sdk.mjs produces a visible trace in a running npx lookspan dashboard.
- No secrets committed; read the key from
process.env.
examples/has01-http-curl.sh,02-otel.mjsand03-mcp.mjs, but nothing for the Vercel AI SDK (aipackage), which is one of the most common ways people build TS/JS agents.Task
Add
examples/04-vercel-ai-sdk.mjsthat:generateText/streamTextcall with the Vercel AI SDK.@lookspan/openai) under the hood, or by POSTing a span tohttp://127.0.0.1:3100/api/ingest(see the curl example for the payload shape).Where
examples/, mirroring the style ofexamples/02-otel.mjs.examples/README.md.Acceptance
node examples/04-vercel-ai-sdk.mjsproduces a visible trace in a runningnpx lookspandashboard.process.env.