Shopify Flow AI Assistant Prompt Guide & Agent Trigger Patterns
No7 Engineering Team
Growth Architecture Unit

Shopify Flow has traditionally been viewed as a closed-loop automation tool for internal store operations, such as tagging high-value customers or sending inventory alerts. However, the recent introduction of the Model Context Protocol (MCP) and the expansion of the Shopify Dev Assistant have fundamentally changed the utility of Flow within the engineering stack. We are seeing a shift where Flow is no longer just a recipient of platform events, but a critical execution layer for AI agents.
The challenge for technical teams is no longer just writing the automation logic, but designing the interface between unstructured AI intent and structured commerce execution. By leveraging shopify flow ai agent triggers, developers can provide LLMs with a safe, governed environment to perform complex operations without granting direct, unmitigated access to the Admin API. This architecture reduces the risk of non-deterministic AI behaviour causing havoc in the production environment.
Shopify Flow AI Assistant Prompt Guide: Example Prompts
The Shopify Flow AI assistant — powered by Sidekick — builds Flow workflows from natural-language prompts: you describe what you want and it generates the trigger, condition, and action for you to review. The quality of the generated Flow depends almost entirely on how specifically you describe those three parts. The prompts below are production-tested patterns our team uses; each names the exact trigger and states numeric thresholds so the assistant emits a real condition step instead of guessing.
Copy-paste prompts for the Flow AI assistant
- Abandoned-checkout email chain: “When a checkout is abandoned, wait 1 hour; if the customer still has no completed order, send the ‘Cart Reminder 1’ email; wait 23 hours and send ‘Cart Reminder 2’ with a 10% code.”
- VIP tagging: “When a customer’s total spend crosses £1,000, add the tag ‘VIP’ and post a message to the #retention Slack channel.”
- Fraud hold: “When an order is created with billing and shipping countries that differ and order value over £500, hold the order for fulfilment and tag it ‘review’.”
- Restock alert: “When a product variant inventory quantity drops below 5, send an email to ops@ with the SKU and current quantity.”
- Post-purchase loyalty: “When an order is paid, call the custom action ‘award-points’ with the order total and customer id.”
Two rules make these prompts reliable. First, name the exact Flow trigger (“order created”, “checkout abandoned”, “inventory quantity changed”) rather than a vague event. Second, for multi-step email chains, describe each Wait step and its duration in order — the assistant will not infer timing you do not state. Once a prompt-built workflow is stable, the same trigger can be invoked programmatically by an AI agent, which is where the architecture below comes in.
The Architecture of Agentic Triggers
In our experience, the most robust way to connect an AI agent to Shopify Flow is through the flowTriggerReceive Admin GraphQL mutation. The agent's middleware calls the mutation with a custom trigger handle and a JSON payload, and Shopify Flow runs any workflow that begins with that trigger. The reverse direction is also supported: a Flow workflow can call back into your app through a custom action, and your handler verifies the request with authenticate.flow() before deciding what to do. Either direction acts as a functional bridge, where the AI determines 'what' needs to happen and Flow determines 'how' it happens within the Shopify ecosystem.
We have found that using Flow as a middleware layer provides several advantages over direct API calls from an agent. Firstly, it offers a visual audit trail that is accessible to non-technical stakeholders. Secondly, it allows for native integration with other Shopify apps without writing custom wrapper code for every integration point. When an agent triggers a Flow workflow, it can pass variables that the workflow then uses to look up metaobjects, update customer records, or adjust discount logic.
The recent support for Metaobject access in Shopify Functions further enhances this. An agent can now query store configuration stored in Metaobjects and use that context to decide which Flow trigger to invoke. This creates a feedback loop where the store's data informs the agent's logic, and the agent's logic drives the store's automation.
Implementing the Model Context Protocol (MCP)
The Model Context Protocol is becoming the standard for how AI agents interact with external data sources. For Shopify merchants, implementing an MCP server allows an AI assistant to 'see' the store's schema and available actions. We typically see engineering teams building thin MCP wrappers around their existing Shopify infrastructure to expose specific Flow triggers as 'tools' that the agent can call.
For a detailed breakdown of how these protocols interact, you may find our guide on agentic commerce protocols useful. By exposing a Flow trigger as an MCP tool, you provide the agent with a typed interface. The agent knows it needs to provide a customer_id and a reason_code, and Flow handles the heavy lifting of the actual database mutation. This separation of concerns is vital for maintaining a stable codebase as your AI implementation grows.
Leveraging Shopify Functions for Context
While Flow handles the asynchronous automation, Shopify Functions provide the synchronous logic required for complex commerce rules. We have observed that the most effective agentic implementations use a combination of both. For instance, a Function might determine the eligibility of a discount based on real-time cart data, while a Flow trigger—invoked by an agent—handles the post-purchase loyalty adjustments.
The introduction of functionHandle and binary testing for Shopify Functions has made it easier to deploy these complex logic gates. When an AI agent triggers a workflow, that workflow can interact with the results of these Functions. This is particularly relevant for merchants using Shopify Functions in production to manage bespoke pricing or shipping rules. The agent acts as the orchestrator, calling the right triggers at the right time based on the customer's conversational context.
Decision Framework: Direct API vs. Flow Agent Triggers
Use this framework to decide how your AI agent should interact with Shopify data.
| Requirement | Direct Admin API Call | Shopify Flow Trigger |
|---|---|---|
| Latency | Low (Synchronous) | Medium (Asynchronous) |
| Complexity | High (Requires custom code) | Low (Low-code builder) |
| Observability | Logs only | Visual execution history |
| Security | Full Scopes required | Scoped to specific workflow |
| Best For | Real-time data retrieval | Multi-step operations |
Security and Governance in Agentic Workflows
One of the primary concerns we hear from CTOs is the risk of an LLM 'hallucinating' an API call and deleting product data or issuing thousands of unauthorised refunds. Using Flow as the execution layer provides a natural sandbox. An agent cannot perform any action that you have not explicitly defined within a Flow workflow.
When setting up shopify flow ai agent triggers, we recommend the following security practices:
- Payload Validation: Use Flow's internal logic to validate that the data sent by the agent falls within expected ranges (e.g., a discount percentage cannot exceed 20%).
- Request Verification: External-to-Flow calls authenticate against your Admin GraphQL session, so guard the API token rather than building separate webhook HMAC checks. For the reverse direction (Flow calling a custom action your app exposes), use
authenticate.flow()— it handles signature verification for you. - Rate Limiting: While Shopify manages Flow's scale, your own agentic middleware should implement rate limiting to prevent the LLM from triggering thousands of workflows in a loop.
- Human-in-the-loop: For high-stakes actions, such as bulk price changes, the Flow workflow should include a 'Wait' step or send an approval request to a Slack channel before proceeding.
For more on maintaining a secure Shopify environment, see our guide on ecommerce security headers and general platform hardening.
The Role of Metaobjects as Agent Memory
A significant bottleneck in agentic commerce is state management. AI agents are typically stateless, meaning they don't 'remember' previous interactions unless that context is passed in the prompt. Shopify Metaobjects can serve as a persistent memory store for your agents. By using Flow to write to Metaobjects, an agent can record customer preferences, previous troubleshooting steps, or bespoke configuration data.
We have found that this approach is much more scalable than trying to manage state within the LLM's context window. Since Shopify recently added Metaobject access to Functions, these 'memories' can now influence the checkout experience in real-time. For example, an agent might trigger a Flow to update a 'Customer Style Profile' metaobject, which a Shopify Function then uses to reorder search results or apply specific upsell logic. This is a primary example of how advanced automation in Shopify Flow is moving toward a more dynamic, personalised model.
What to do next
To begin integrating AI agents with your Shopify Flow environment, we suggest taking the following technical steps:
- Audit your manual processes: Identify workflows that currently require human intervention but follow a predictable logic. These are your primary candidates for agentic triggers.
- Build a prototype MCP server: Use the Shopify Storefront or Admin API to create a bridge that exposes one or two specific Flow custom triggers — invoked from your agent via the
flowTriggerReceiveAdmin GraphQL mutation — to your AI assistant. - Define your data contract: Clearly document the JSON schema required for each Flow trigger. This ensures that your agent provides the correct parameters every time.
- Implement observability: Set up monitoring for your Flow execution logs to identify where the agent might be providing malformed data or triggering unnecessary workflows.
If you are exploring how to scale these patterns across multiple storefronts or complex enterprise environments, our team can provide an architectural review of your current automation strategy to ensure it is ready for the shift toward agentic commerce.
Companion code: the reference action handler that verifies a Flow request via authenticate.flow(), the Zod schema, and the decision matrix in plain Markdown live in our open-source engineering-notes repository at github.com/no7software/engineering-notes (Apache 2.0).
Frequently Asked Questions
The questions buyers and engineers ask us most about this topic.
Can I trigger Shopify Flow workflows from an AI agent safely?
Yes. The HTTP Request trigger lets an external agent POST a JSON payload into Flow, which then executes platform actions inside its own audit trail. We treat Flow as a sandbox: the agent decides what should happen, Flow validates the payload (HMAC, ranges, allowlists) and executes only the actions we explicitly authorised. Avoid giving an agent full Admin API access — Flow as the execution layer is safer because the agent can only invoke workflows you have already defined.
When should Flow trigger an AI agent vs the agent triggering Flow?
Flow triggers an agent when you need a structured decision based on real-time order context — fraud-context tagging, dynamic order routing, customer-service ticket triage. The agent triggers Flow when an end-user conversation produces an action that needs to land in Shopify — adjusting a customer's tier, scheduling a follow-up, recording a preference in a metaobject. Cap agent-triggered actions with human review for anything revenue-critical; agents fail silently more often than they fail loudly.
Do MCP servers replace the need for Shopify Flow?
No — they complement each other. MCP servers expose live data and tool primitives to the agent; Flow orchestrates multi-step platform workflows. We typically use MCP for the read-and-decide path and Flow for the write-and-side-effect path. A pure MCP-only architecture lacks the visual audit trail and built-in retry semantics that Flow provides; a Flow-only architecture lacks the rich-context decision-making the agent layer adds.
What prompts work best with the Shopify Flow AI assistant?
Specific, single-purpose prompts that name the exact trigger and state numeric thresholds. Structure each prompt as trigger then condition then action — for example: "When a checkout is abandoned, wait 1 hour, then if the customer has no completed order send the Cart Reminder 1 email; wait 23 hours and send Cart Reminder 2 with a 10% code." For multi-step email chains, describe every Wait step and its duration explicitly, because the assistant will not infer timing you do not state. Naming the literal trigger ("order created", "inventory quantity changed") rather than a vague event is what makes the generated Flow reliable.
Working on this? Send us the details — we'll take a look.