Skip to content

Quickstart: Vercel AI SDK

In about five minutes, you export a Vercel AI SDK call to Mibo with OpenTelemetry, send one trace, and create a test from it. Mibo evaluates the traces your code sends. It never calls your Agent. If you already export traces to another backend, keep it and add Mibo with the Collector fan-out.

  • A Mibo account with a verified email. Mibo rejects traces and AI features until you verify. See Email verification.
  • Node.js 22.15 or later.
  • AI SDK 7 and an OpenAI API key. Another AI SDK provider works the same way.
  1. Create an account at app.mibo-ai.com, or sign in, and click Set up your Agent.
  2. Enter an Agent Name and choose the Other agent type. Click Continue to API key.
  3. Click Create Agent API key and copy the key. Mibo shows it only once. Click I’ve saved it — continue to traces.
  4. In the Agent navigation, open Set up agent. Set OTLP Service Name to support-agent-prod and click Save Changes.

Mibo routes each OTLP trace to the Agent whose OTLP Service Name equals the trace’s service.name. A missing name returns 400 OTLP_SERVICE_NAME_REQUIRED, and an unknown one returns 404 OTLP_PLATFORM_NOT_FOUND.

Terminal window
npm install ai @ai-sdk/otel @ai-sdk/openai @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-proto zod
Terminal window
export OTEL_SERVICE_NAME=support-agent-prod
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.mibo-ai.com/public/traces
export OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-api-key=<YOUR_MIBO_API_KEY>
export OTEL_METRICS_EXPORTER=none
export OTEL_LOGS_EXPORTER=none
export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

Use the traces-specific OTEL_EXPORTER_OTLP_TRACES_ENDPOINT. The exporter sends to that URL as written. The generic OTEL_EXPORTER_OTLP_ENDPOINT appends /v1/traces, which Mibo does not serve. The last two lines stop the SDK from exporting metrics and logs, which Mibo does not accept.

Save this as agent.mjs:

import { OpenTelemetry } from '@ai-sdk/otel';
import { openai } from '@ai-sdk/openai';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
import { NodeSDK } from '@opentelemetry/sdk-node';
import { generateText, registerTelemetry, stepCountIs, tool } from 'ai';
import { z } from 'zod';
const sdk = new NodeSDK({ traceExporter: new OTLPTraceExporter() });
sdk.start();
registerTelemetry(new OpenTelemetry({ agentSpanName: 'functionId' }));
const { text } = await generateText({
model: openai('gpt-4o-mini'),
system: 'You are a support agent for an online store.',
prompt: 'Where is my order A-1042?',
tools: {
lookupOrder: tool({
description: 'Look up an order by ID',
inputSchema: z.object({ orderId: z.string() }),
execute: async ({ orderId }) => ({ orderId, status: 'shipped', eta: 'Friday' }),
}),
},
stopWhen: stepCountIs(3),
telemetry: { functionId: 'support-agent' },
});
console.log(text);
await sdk.shutdown();

Run it:

Terminal window
node agent.mjs

The script prints the model’s reply, for example Your order A-1042 has shipped and should arrive on Friday. sdk.shutdown() flushes the trace before the process exits. In a long-running server, start the SDK once at startup instead.

Open the Agent’s Traces page in Mibo. The trace has an invoke_agent support-agent root span, a step span per model step, a chat gpt-4o-mini span per model call, and an execute_tool lookupOrder span.

  1. In the Agent navigation, open Create tests with AI.
  2. Click Use real trace. In Ground generation on a real trace, select your trace and click Use this trace.
  3. Review the generated test cases and click Save. Keep the test enabled, with Passive behavior set to Always run or Run when relevant.
  4. Run node agent.mjs again. Mibo evaluates each new trace against your saved tests.
  5. Open the test and check Last Result.
Data Attribute Recorded by default
User input gen_ai.input.messages Yes, while telemetry.recordInputs is true
Final response gen_ai.output.messages Yes, while telemetry.recordOutputs is true
Tool calls gen_ai.tool.name and gen_ai.tool.call.arguments on execute_tool spans Arguments only while recordInputs is true
Token usage gen_ai.usage.input_tokens and gen_ai.usage.output_tokens Yes

Both content options default to true. If you set recordInputs: false, Mibo has no user input, so Run when relevant tests are skipped and the trace shows No usable input. Always run tests still run. If you set recordOutputs: false, checks on the reply have no text to read. In AI SDK 7, experimental_telemetry is a deprecated alias of telemetry and takes the same options.

Prompts and replies can contain personal data. Mibo always redacts secrets and redacts personal data when your project enables it. See Data handling.

Setting Value
Endpoint POST https://api.mibo-ai.com/public/traces. Set the full URL. Exporters that take a base URL append /v1/traces.
Authentication x-api-key header
Encoding OTLP/HTTP protobuf or JSON. Mibo does not accept OTLP/gRPC.
Compression gzip is accepted. Set OTEL_EXPORTER_OTLP_TRACES_COMPRESSION=gzip to enable it.
Size limit 10 MB per request. See Payload size limits.
Routing service.name must match the Agent’s OTLP Service Name.