Skip to main content
A feature often makes several LLM calls, for example classifying a ticket, then drafting the reply. Wrap the feature’s code in propagate_metadata / propagateMetadata once: every gateway call made inside carries its feature_name, and each pass through the scope is one feature run, however many calls it makes. You then see, per feature:
  • what it costs in total, per run and per customer, its number of runs, and the models it runs on, in AI cost and AI margin;
  • alerts when its cost per run or its number of runs moves, in Alerts.

One feature run across several services

Each scope starts a new feature run. When one run spans several services, for example an API classifying the ticket and a worker drafting the reply, create the run’s id once with create_feature_run_uuid() / createFeatureRunUuid(), send it along with the work, and pass it as feature_run_uuid / featureRunUuid to every scope of the run.

Customer and tags

propagate_metadata / propagateMetadata also takes customer_name and extra_tags, applied to every call of the scope. Both can instead be set on each request, in its weflayr field (customer_name and tags). When both set a value, the request’s wins.