How we moved the pricing algorithm out of the Yandex Taxi code (and why it was not obvious from the start)

Gleb Fedorov5 Aug 2026

Problem

A ride price depends on dozens of factors: discounts, surge demand, geozones and passenger requirements such as a pet or skis. At Yandex Taxi many teams change these rules, about twice a week. Rolling out the pricing service on fifty pods took about 40 minutes, and one change could not be reverted alone, because the previous revision also dropped other changes. Analysts who own the rules could not change them without knowing the whole service.

Example from the article: a feature flag was removed after a positive A/B test that later proved invalid. The same revision carried a fix for passengers with a guide dog, so a rollback was impossible.

Solution in brief

The team moved the pricing algorithm out of the C++ service into a small DSL stored in an admin panel and applied without a deploy. A price is a chain of pure transformations over typed input parameters, and each team owns its own links. The service keeps only data fetching, the interpreter and the binding between C++ structures and DSL types.

Questions this case answers
  • How to let non-engineers change a frequently modified business-rule algorithm without redeploying the service that executes it, while keeping every change versioned, verifiable and quickly reversible
  • How to assemble the typed input of a latency-sensitive calculation from many independent services in parallel when some of them may fail
  • How to let analysts and several teams change pricing rules several times a week without redeploying the pricing service?
  • How to roll back a single pricing change quickly when other changes ship in the same service revision?

Tools and methods

  • BackendVariables — typed calculation input, described in yaml
  • Processors and sources — each processor fills its own fields; sources are fetched asynchronously in dependency order
  • Price transformation DSL — constants only, no loops, pure functions
  • ANTLR 4 — DSL grammar
  • Z3 — formal verifier of DSL programs
  • Boost.Fusion — binds DSL fields to C++ structure members
  • userver — asynchronous framework
Continue reading — it's free

Google or a one-time email code. No password.