Orq MCP is live: Use natural language to interrogate traces, spot regressions, and experiment your way to optimal AI configurations. Available in Claude Desktop, Claude Code, Cursor, and more. Start now →
Connect Mastra to Orq.ai’s AI Gateway for complete observability, built-in reliability, and access to 300+ LLMs across 20+ providers.
AI Gateway
Route your LLM calls through the AI Gateway with a single base URL change. Zero vendor lock-in: always run on the best model at the lowest cost for your use case.
Observability
Instrument your code with OpenTelemetry to capture traces, logs, and metrics for every LLM call, agent step, and tool use.
Mastra is a TypeScript framework for building AI-powered applications with pipelines, agents, and workflows. By connecting Mastra to Orq.ai’s AI Gateway, you transform experimental AI applications into production-ready systems with enterprise-grade capabilities.
Integrate Mastra with Orq.ai’s observability to gain complete insights into pipeline execution, agent performance, workflow orchestration, and system reliability using OpenTelemetry.
Mastra supports native OpenTelemetry integration for comprehensive observability.Create an instrumentation.mjs file in your Mastra project:
TypeScript
import { NodeSDK } from '@opentelemetry/sdk-node';import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';const sdk = new NodeSDK({ traceExporter: new OTLPTraceExporter({ url: 'https://api.orq.ai/v2/otel/v1/traces', headers: { Authorization: "Bearer <ORQ_API_KEY>" } }), instrumentations: [getNodeAutoInstrumentations()],});sdk.start();
Enable Telemetry in your Mastra initialization:
TypeScript
import { Mastra } from "@mastra/core";import { Observability } from "@mastra/observability";import { OtelBridge } from "@mastra/otel-bridge";export const mastra = new Mastra({ agents: { /* register agents here */ }, observability: new Observability({ configs: { default: { serviceName: "mastra-app", bridge: new OtelBridge(), }, }, }),});
Register every agent in the agents field of the Mastra constructor. Unregistered agents do not emit traces, because OtelBridge only sees agents passed in at construction time.
All Mastra pipelines and agent calls will be instrumented and exported to Orq.ai through the OTLP exporter.