Skip to main content

shopagent

GIF of generating a Shopify agent

Generate a Shopify agent on the fly thanks to Llama and LSD.

Contents

Getting started

GIF of generating a Shopify agent

  1. Clone the repo

  2. Run uv run main.py

  3. Answer prompt

  4. Now you have an agent.rb file

Why

Shopify LSD diagram

Gumroad recently went open source to support AI writing Ruby code. In order to assist the initiative towards a more AI-infused world, we gathered the Shopify GraphQL spec plus code examples to make it easy to generate Shopify agents.

Why only the admin API?

The official Shopify MCP server explicitly prompts to not interact with the storefront or functions APIs. If there is a specific dataset you're interested in that wouldn't bother Shopify, then feel free to file an issue.

Gimme the data

If you're interested in the Shopify GraphQL being programmatically accessible, the two files you'd be most interested in are:

Pretty printing the data

  1. Clone this repository.
$ git clone https://github.com/lsd-so/Shopify-GraphQL-Spec.git
  1. Update the main.py file file to print_data() instead of gen_agent()
def main():
-    # get_data()
+     get_data()
-     get_data()
+    # gen_agent()
    # print_data()
  1. Using uv (Why?), run the main.py file at the root of the project.
$ uv run main.py

Getting the data yourself

If you'd like to get the data yourself or update to match a new version of the Shopify API, then continue reading to learn how.

Help me vibe code this

Screenshot of Cursor generating code using the Shopify GraphQL API

LLMs are already familiar with GraphQL so this gives them the ability to understand Shopify's GraphQL specifically.

  1. Download the JSON file and Python models
  2. Place both the JSON file and Python file in your repo
    1. Make sure you are using the models.py file in api/!
  3. Go to Cursor, click "New chat", click "Add context", click "Files & folders", and add both files to your context
  4. Vibe code with Cursor now understanding how to use the Shopify GraphQL API
    1. If something doesn't work, try checking the option for longer context

Mining Shopify GraphQL yourself

  1. Set the LSD_USER and LSD_API_KEY environment variables using your authenticated credentials.
$ export LSD_USER='your@email.domain'
$ export LSD_API_KEY='<api key from profile>'
  1. Clone this repository.
$ git clone https://github.com/lsd-so/Shopify-GraphQL-Spec.git
  1. And update the main.py file file to get_data() instead of gen_agent()
def main():
-    # get_data()
+     get_data()
-     gen_agent()
+    # gen_agent()
    # print_data()
  1. Use uv.
$ uv run main.py

And there ya go.

LSD Cache

When running this python project, it involves querying the same page more than once for different groups of elements (such as in here or here). To prevent overloading Shopify's servers, pages in distinct states (whether statically off a public URL or following a sequence of deterministic interactions) are specifically cached for up to 15 minutes on LSD for scenarios like this.

Think of LSD as a language with caching that provides a more developer friendly Wayback machine. Follow us on Twitter to stay tuned!

Metadata

Release files for shopify-graphql 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shopify-graphql 0.1.0
File Size Uploaded Provenance
shopify_graphql-0.1.0.tar.gz 4.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for shopify-graphql 0.1.0
File Interpreter ABI Platform
shopify_graphql-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / shopify_graphql-0.1.0.tar.gz

Download URL shopify_graphql-0.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2f31281044c1b41ebfa58d93fc13d264df79a3fbcf0ea4b7f011922d40556308
BLAKE2b-256 checksum
How to use checksums
6906185e4bd4d6d31e03ebc8cc3e4cacd2d03286be3500009de696077c139e50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / shopify_graphql-0.1.0-py3-none-any.whl

Download URL shopify_graphql-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8578f19b016c56380080dd56ce79506a7d9956cb417338d27317264d807b8618
BLAKE2b-256 checksum
How to use checksums
547e282c7cf3bbfbb22479caf5aaaf57834c1738b03287cc86a53a6c4fa649c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Security for shopify-graphql 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page