Setup
Register OpenTelemetry and point the exporter at AgentMark
In a Next.js app this goes in
instrumentation.ts at the project root. Use your AgentMark API key and app id from project settings.Run your app
Run your app as usual. Each model call and tool call arrives in AgentMark as a span, grouped into a trace. See Traces and logs.
What AgentMark captures
AgentMark normalizes the AI SDK’sai.* and gen_ai.* span attributes natively:
- Generations: each
ai.generateText.doGenerateandai.streamText.doStreamspan (and the object variants) becomes a generation carrying its model id, input messages, and output text or object. - Tool calls: AgentMark labels tool-call spans by tool name, with their arguments and results.
- Token usage: input, output, total, and reasoning tokens, which feed cost tracking.
- Finish reason and settings: the response finish reason plus request settings such as temperature, max tokens, top-p, and penalties.
- Metadata: AgentMark preserves anything you pass via
experimental_telemetry.metadataon the trace.
Alternative: route through OpenInference
If you already standardize on the OpenInference conventions across frameworks, you can map the AI SDK’s spans onto them with the OpenInference span processor instead of exporting raw. AgentMark reads either shape. Install the span processor alongside the exporter:Next steps
OpenInference
How AgentMark reads OpenInference attributes
Traces and logs
Explore traces once they arrive
Have questions?
Reach out any time:
- Email the team at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about AgentMark’s business solutions