Metadata
Attach custom key/value tags to runs and spans so you can filter and break them down later.
Metadata is free-form key/value data you attach to a run or a span. Unlike user properties, which live on the user, metadata describes a single execution: the tenant, the environment, a feature flag, a request ID. It's filterable and breakdownable in the dashboard.
Run metadata
Set metadata on the whole run with setMetadata / set_metadata.
await trodo.wrapAgent('support', async (run) => {
run.setMetadata({ tenant: 'acme', plan: 'pro', env: 'prod' });
// ...
});with trodo.wrap_agent('support') as run:
run.set_metadata({'tenant': 'acme', 'plan': 'pro', 'env': 'prod'})
...You can also pass metadata as an option to startRun.
Span attributes
Attach key/value pairs to a single span with setAttribute / set_attribute. They show in the span detail and are searchable.
await trodo.withSpan('billing.lookup', async (span) => {
span.setTool('billing.lookup');
span.setAttribute('customer_tier', 'enterprise');
span.setAttribute('region', 'eu-west-1');
return await billing.lookup(id);
}, { kind: 'tool' });with trodo.span('billing.lookup', kind='tool') as span:
span.set_attribute('customer_tier', 'enterprise')
span.set_attribute('region', 'eu-west-1')
result = billing.lookup(id)Run metadata vs. span attributes
| Set with | Scope | |
|---|---|---|
| Run metadata | setMetadata / set_metadata | The whole run |
| Span attribute | setAttribute / set_attribute | One step inside the run |
Use round-number scalars and short strings (tenant, region, flags) so they filter cleanly.
Next
- Custom Properties for traits that live on the user
- Add manual spans for the span API