Monitor your agents

Send OpenTelemetry traces from your agent to see token usage, tool calls, and latency in the Astro AI dashboard
View as Markdown

Astro AI automatically monitors agents that interact with common AI model providers. After you deploy an agent, its token usage, tool calls, and latency appear on the Insights page. For deeper observability, Astro AI provides adapters for common frameworks.

Framework guides

Manually attaching observability

When an adapter isn’t available for your framework, you can instrument an agent manually using standard OpenTelemetry. Every deployed agent container receives these environment variables automatically:

VariablePurpose
OTEL_EXPORTER_OTLP_ENDPOINTOTLP HTTP base URL. Append /v1/traces for the traces signal.
ASTRO_AGENT_NAMEUse as OpenTelemetry service.name.
ASTRO_AGENT_BUILDUse as OpenTelemetry service.version.

OTEL_EXPORTER_OTLP_ENDPOINT is unset during local development. Guard your instrumentation on the variable so the agent runs cleanly in both environments.

Node.js

1

Install the OpenTelemetry SDK

Install the SDK and the OTLP HTTP trace exporter:

$bun add @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http @opentelemetry/resources @opentelemetry/semantic-conventions
2

Initialize the SDK

Initialize the SDK at the entry point of your agent, before any other imports that you want traced:

1import { NodeSDK } from "@opentelemetry/sdk-node";
2import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
3import { resourceFromAttributes } from "@opentelemetry/resources";
4import {
5 ATTR_SERVICE_NAME,
6 ATTR_SERVICE_VERSION,
7} from "@opentelemetry/semantic-conventions";
8
9if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {
10 new NodeSDK({
11 resource: resourceFromAttributes({
12 [ATTR_SERVICE_NAME]: process.env.ASTRO_AGENT_NAME ?? "agent",
13 [ATTR_SERVICE_VERSION]: process.env.ASTRO_AGENT_BUILD ?? "dev",
14 }),
15 traceExporter: new OTLPTraceExporter({
16 url: `${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces`,
17 }),
18 }).start();
19}
3

Emit spans

With the SDK running, emit spans wherever you want them — see the OpenTelemetry tracing API for the span API and the auto-instrumentation packages for HTTP, fetch, and other off-the-shelf coverage.

4

Verify

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