@agentmark-ai/otel package (withAgentMark + AgentMarkSpanProcessor); in Python it’s built into agentmark-sdk (with_agentmark, registered automatically by init_tracing).
Reach for it when you instrument with OpenTelemetry rather than the AgentMark SDK’s span() helpers. It’s the recommended way to group traces on the Vercel AI SDK v7, where the telemetry.metadata option no longer reaches spans. It also groups any other OpenTelemetry span in the same scope, such as an OpenInference instrumentor, an HTTP request, or a custom span.
TypeScript
Register the span processor
Add
AgentMarkSpanProcessor to your OpenTelemetry setup with your API key and app id from project settings. The register() call installs the context manager that carries grouping across await.Python
Python grouping lives in theagentmark-sdk package. init_tracing() registers the grouping processor for you, so you only wrap your calls.
Install the package:
with_agentmark(...). Every span started inside it (sync or async) carries the grouping:
What gets grouped
withAgentMark accepts these fields:
sessionIdandsessionName: group related calls into one session.userId: attribute the trace to a user.traceName: name the trace.tags: string labels for filtering and search.metadata: any custom key and value pairs, surfaced as trace metadata.
with_agentmark takes the same fields in snake_case: session_id, session_name, user_id, trace_name, tags, and metadata.
withAgentMark needs an OpenTelemetry context manager so the grouping propagates across await. Both NodeTracerProvider.register() and @vercel/otel register one.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