AI SDK

Send Vercel AI SDK telemetry to Astro AI and optionally serve the agent over Astro AI messaging
View as Markdown

Send traces from a Vercel AI SDK agent to Astro AI so its model calls, tool calls, and latency appear in the dashboard. You can optionally serve the agent over Astro AI messaging to use it in the Astropods playground.

@astropods/adapter-ai-sdk exports two functions you can use independently:

  • astroTelemetry() returns AI SDK experimental_telemetry settings wired to Astro AI’s OTLP exporter.
  • serve() connects an Experimental_Agent to Astro AI’s messaging service so your agent works in the Astropods playground.

Targets ai >= 6.0.0.

Before you start

  • A deployable Astro AI agent project.
  • Astro AI sets OTEL_EXPORTER_OTLP_ENDPOINT only on deployed containers, so traces appear once the agent runs on the platform — not during local development.

Install

$bun add @astropods/adapter-ai-sdk

Send telemetry to Astro AI

Add astroTelemetry() into the agent’s experimental_telemetry:

1import { Experimental_Agent as Agent } from "ai";
2import { openai } from "@ai-sdk/openai";
3import { astroTelemetry } from "@astropods/adapter-ai-sdk";
4
5const agent = new Agent({
6 model: openai("gpt-4o"),
7 instructions: "You are a helpful assistant.",
8 experimental_telemetry: astroTelemetry(),
9});

Traces capture each turn’s model calls, tool calls, and latency, attributed to the deployed agent. Use this on its own when you serve the agent from your own framework and want AI traces reported in the dashboard.

Serve over Astro AI messaging

To run the agent on Astro AI messaging, pass it to serve():

1import { Experimental_Agent as Agent } from "ai";
2import { openai } from "@ai-sdk/openai";
3import { serve, astroTelemetry } from "@astropods/adapter-ai-sdk";
4
5const instructions = "You are a helpful assistant.";
6
7const agent = new Agent({
8 model: openai("gpt-4o"),
9 instructions,
10 experimental_telemetry: astroTelemetry(),
11});
12
13serve(agent, { name: "My Agent", instructions });

Passing instructions into serve() makes your agent’s system prompt visible in the Astropods playground. It’s optional — omit instructions to keep the prompt hidden.

Verify

Deploy the agent, send it a message, then open the agent’s detail page in the dashboard. Traces appear within ~30 seconds.

If nothing shows up:

  • Confirm experimental_telemetry: astroTelemetry() is on the agent.
  • Confirm OTEL_EXPORTER_OTLP_ENDPOINT is set in the deployed container.
  • Check the container logs for OpenTelemetry export errors.