Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 12 min read Deep dive mediumAdept

Maestro: The Orchestration Language Powering Shopify Flow

Shopify rebuilt Flow around Maestro, a domain-specific orchestration language that decouples the merchant-facing visual editor from a horizontally scalable execution engine. Maestro coordinates calls to host-language (Ruby) primitive functions and records checkpoints to durable storage such as Kafka, Redis or MySQL, so interrupted executions resume without redoing completed steps, giving at-least-once semantics. Flow workflows are translated into Maestro functions. Maestro's static analysis (type checking, scope and field-navigation checks, symbol tables) drives fast in-editor validation and code completion. Activation adds usage analysis to limit GraphQL data hydration, plus compilation that strips unused definitions before deployment to the engine.

Assumes: workflow orchestration conceptsstatic type checkingGraphQL APIs

Related posts

  • Flow generation through natural language: An agentic modeling approach

    Shopify Engineering mediumAdept

    Shopify fine-tuned Qwen3-32B into a tool-calling agent that turns natural-language requests into Shopify Flow automations for Sidekick, reporting 2.2x lower latency and 68% lower cost than the closed frontier model it replaced. Training data was bootstrapped by reverse-generating user queries and tool trajectories from real merchant workflows. Transpiling Flow's JSON DSL into Python, kept lossless by a round-trip transpiler, raised syntactic correctness by 22 points and semantic correctness by 13. Small train/serve mismatches in tool names, tool order and JSON key order measurably hurt accuracy, and a 1% production rollout exposed a 35% activation gap that offline benchmarks had hidden. That gap was closed with a human-calibrated LLM judge, slice tagging and a weekly retraining flywheel on H200 nodes with FSDP, orchestrated by Tangle.

  • Introducing Roast: Structured AI workflows made easy

    Shopify Engineering easyNovice

    Roast is Shopify's open-source, Ruby-based CLI framework for orchestrating structured AI workflows. It interleaves non-deterministic LLM steps with deterministic code through YAML workflow definitions and markdown/ERB prompts. Workflows can mix directory prompt steps, shell commands, inline prompts, custom Ruby steps, parallel steps, iteration and conditionals. Steps share conversation context, and session replay lets authors resume from any step without re-running expensive AI calls. A Claude Code-powered CodingAgent handles iterative tasks such as fixing Sorbet type errors after deterministic cleanup. The core lesson is that breaking agent tasks into discrete, guarded steps makes AI reliable enough for jobs like grading tests at scale.

  • How Shopify Dynamically Routes Storefront Traffic

    Shopify Engineering mediumAdept

    Shopify shifted storefront traffic from its legacy Rails storefront to a rewritten renderer using a rule-based routing system in nginx/OpenResty Lua load balancers, with rules stored as JSON in a control plane and managed via the spy chatbot so changes skip CI and deploys. Each rule specifies filters, target shop IDs, and sampling rates for rendering, forward verification (legacy renders, new storefront checked), reverse verification, and self-verification against the local region's deployment. Rules are checked in the nginx rewrite phase, verification is decided in the header filter phase, and duplicate requests are sent asynchronously via nginx timers in the log phase so clients never wait on both upstreams. The same mechanism let the team mirror traffic to a separate deployment disconnected from Redis to test resilience before BFCM.

  • Building a Real-time Buyer Signal Data Pipeline for Shopify Inbox

    Shopify Engineering mediumAdept

    Shopify built a streaming pipeline on Apache Beam and Google Cloud Dataflow that surfaces cart actions and order completions to merchants inside Shopify Inbox conversations. Kafka inputs (Monorail and Debezium CDC from MySQL) are filtered, keyed by buyer token with CoGroupByKey, and aggregated in a Global Window. Stateful processing compares timestamps to drop out-of-order events, derives cart actions from quantity changes, clears cart state on checkout, and uses event-time timers to expire state. In an A/B test, merchant response rate rose 2 percentage points and conversation conversion rate rose 0.7 points, with no change in response time.

  • Shopify’s journey to faster breadth-first GraphQL execution

    Shopify Engineering hardMaster

    Shopify built GraphQL Cardinal, a breadth-first GraphQL execution engine that calls each field resolver once with the full set of objects at that level instead of once per object. Depth-first execution, used by graphql-ruby and graphql-js, multiplies per-field overhead from tracing hooks, authorization and dataloader promises by response breadth. Cardinal builds a typed execution tree, runs a bottom-up lookbehind planning pass inspired by Grafast, and executes generation by generation with flat object/result sets in a queue-driven loop rather than recursion. Large list queries ran up to 15x faster with 90% less memory and saved over 4s at P50. The tradeoffs are that errors are inlined and located by a final depth traversal, and that migrating a monolith from one-in/one-out resolvers requires an incremental bridge.

The quest for software engineering knowledge.

Look:
Layout: