Ecommerce Agent Workflows

This guide shows how to orchestrate Shopify → NetSuite → DCL operations with multiple autonomous AI Agents powered by StateSet’s Agent Framework, Workflow Framework, and Agentic OS Connector.

CTOs, Solutions Architects, and DevOps engineers building a resilient, observable, and fully-automated order-to-cash pipeline.

StateSet One platform orchestrates complex order operations by connecting various e-commerce and backend systems. This automation streamlines processes from order capture to fulfillment, inventory management, and customer service. Key benefits include:

  • Automated Order Flow: Seamlessly move order data from Shopify to NetSuite and then to DCL for fulfillment.
  • Real-time Fulfillment Updates: Keep Shopify and NetSuite synchronized with shipment and tracking information from DCL.
  • Inventory Accuracy: Maintain consistent inventory levels between NetSuite, DCL, and Shopify.
  • Efficient Inbound Logistics: Automate PO/ASN communication with DCL and item receipt processing in NetSuite.
  • Agentic Customer Service: Enhance Gorgias with AI-powered responses and actions via integrations with Recharge and Shopify.
  • Centralized Orchestration: Utilize StateSet for robust, observable, and scalable workflow management.

This guide focuses on the API-driven interactions orchestrated by the workflows defined in workflows.js and activities in activities.js.


1. Architectural Primer

LayerPurpose
Agent FrameworkRuns containerised agents that each own one business capability. Triggers → Preconditions → Actions → Post-conditions ensure deterministic, idempotent runs.
Workflow FrameworkDeclarative, version-controlled sequences of API calls with rollback, retries, and logging baked in. Every Agent owns a single Workflow implementation.
Agentic OS ConnectorA thin HTTP/gRPC façade that pushes normalised events into the Agent bus, manages secrets, schedules retries, and renders the cross-system Work-Graph UI.

2. Catalog of Agents & Workflows

Order Processing Tier

#Agent / WorkflowTriggerPurpose
1shopifyToNetsuiteWorkflowShopify AgentConvert Shopify Order → NetSuite Sales Order (SO); tag order SENT_TO_NS.
2netsuiteToDCLWorkflowNetSuite AgentTransform SO and POST to DCL; set custbody_sent_to_3pl = T.
3dclTrackingUpdateWorkflowDCL AgentCreate Item Fulfillment & optional Cash Sale in NetSuite; push tracking to Shopify.

Inventory Management Tier

#Agent / WorkflowTriggerPurpose
4dclPoNotificationWorkflowNetSuite PO/TO status Pending ReceiptSend ASN (Advance Ship Notice) to DCL.
5dclPoReceiptWorkflowDCL AgentCreate Item Receipt, reconcile quantity, close PO if complete.
6inventorySyncWorkflowCron (*/15 min)Pull inventory from NetSuite, bulk update Shopify.
7inventoryBundlesSyncWorkflowCron (*/15 min +10 sec)Compute bundle availability and update Shopify bundles.

Financial Processing Tier

#Agent / WorkflowTriggerPurpose
8netsuiteInvoiceFlowSO status Pending BillingCreate Invoice, tag SO INVOICED.
9netsuitePaymentFlowInvoice Open + payment settlementRecord payment, apply to Invoice, close Invoice.

3. End-to-End Pipeline Walkthrough


4. Deployment & Operations

  1. Packaging – Each Agent ships as a container invoking agent run.
  2. Versioning – Semantic versions; upgrades spin a shadow copy replaying last 24 h of events before cut-over.
  3. Observability – Logs & metrics stream to Grafana/Prometheus; Work-Graph UI renders lineage and retries.
  4. Error Handling – Automatic exponential retries for idempotent calls; compensation jobs registered per Agent; Slack/E-mail hooks after N failures.

5. FAQ

Q: Do I need all nine agents on day one?
No. Start with the Shopify→NetSuite workflow, then gradually enable the others as your operational maturity grows.

Q: How are bundle quantities computed?
inventoryBundlesSyncWorkflow requests BOM data from NetSuite, then calculates bundle_qty = MIN(component_qty[]).

Q: Can I extend this to Amazon or WooCommerce?
Yes—write a new Agent that maps their order schema to the canonical OrderCreated event expected by shopifyToNetsuiteWorkflow.


6. Triggering Workflows from the CLI

Once your Agents are deployed you can kick-off any workflow on demand via the Stateset CLI (a lightweight Node binary).

Single commandstateset run --connector <workflow> posts a JSON payload to the Agentic OS Connector REST endpoint. • Stateless – The CLI simply packages your payload and returns the workflow_id; orchestration, retries and logging are handled by the platform. • Environment-driven – Point to prod, staging or local dev-tunnels by changing the STATESET_ENDPOINT env variable or passing --endpoint. • CI/CD ready – Works in GitHub Actions, CircleCI, or any shell, enabling synthetic orders during pipeline builds or bulk-replay of historical events. • Security – Uses the same API tokens as the dashboard; no secrets are stored locally.


Next Steps

  1. Read the Agents Quickstart to understand core Agent APIs.
  2. Explore Order Operations for advanced order-management patterns.

Happy automating! 🚀