Setting tags
Attach tags to a span by setting theagentmark.tags span attribute. The gateway accepts a JSON array string, a comma-separated string, or a native array.
Set the attribute inside a span() callback using ctx.setAttribute(). The Dashboard aggregates the tag list onto the parent trace.
- TypeScript
- Python
Tags on child spans
You can set tags on any span. The gateway aggregates tags across a trace’s spans into the trace-level tag list shown in the Dashboard.Filtering by tags
Tags appear as a column in the trace list. Filter by navigating to Traces, clicking Filters, selecting Tags, and choosing an operator and value.Tags vs metadata
Limits
- Up to 20 tags per span (the gateway drops extra tags).
- The gateway trims each tag, which must be 1–100 characters. It drops longer tags.
- The gateway ignores empty strings.
Best practices
- Use kebab-case:
production,team-alpha,chat-v2(notProduction,team_alpha) - Define tags as constants to avoid typos
- Keep the tag set small. Tags with hundreds of unique values belong in metadata
- Recommended patterns: environment (
production,staging), team (team-alpha), feature (chat-v2), experiment (exp-new-prompt), release (v2.1.0)
Metadata
Key-value pairs for context and debugging
Filtering and search
Combine tags with other filters
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