Add your description here
Project description
shopagent
Generate a Shopify agent on the fly thanks to Llama and LSD.
Contents
- Getting started
- Why
- Why only the admin API?
- Gimme the data
- Help me vibe code this
- Mining Shopify GraphQL yourself
- Mining
- LSD Cache
Getting started
-
Clone the repo
-
Run
uv run main.py -
Answer prompt
-
Now you have an
agent.rbfile
Why
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:
api/models.py-> Where the Pydantic models for the derived GraphQL operations are definedshopify_api.json-> Where the Shopify GraphQL spec can be viewed as a JSON with code examples included.- This is structured as a
ShopifyAPIobject - For an example of working from the already obtained data, see
get_datainmain.py
- This is structured as a
Pretty printing the data
- Clone this repository.
$ git clone https://github.com/lsd-so/Shopify-GraphQL-Spec.git
- Update the
main.pyfile file toprint_data()instead ofgen_agent()
def main():
- # get_data()
+ get_data()
- get_data()
+ # gen_agent()
# print_data()
- Using uv (Why?), run the
main.pyfile 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
LLMs are already familiar with GraphQL so this gives them the ability to understand Shopify's GraphQL specifically.
- Download the JSON file and Python models
- Place both the JSON file and Python file in your repo
- Make sure you are using the
models.pyfile inapi/!
- Make sure you are using the
- Go to Cursor, click "New chat", click "Add context", click "Files & folders", and add both files to your context
- Vibe code with Cursor now understanding how to use the Shopify GraphQL API
- If something doesn't work, try checking the option for longer context
Mining Shopify GraphQL yourself
- Set the
LSD_USERandLSD_API_KEYenvironment variables using your authenticated credentials.
$ export LSD_USER='your@email.domain'
$ export LSD_API_KEY='<api key from profile>'
- Clone this repository.
$ git clone https://github.com/lsd-so/Shopify-GraphQL-Spec.git
- And update the
main.pyfile file toget_data()instead ofgen_agent()
def main():
- # get_data()
+ get_data()
- gen_agent()
+ # gen_agent()
# print_data()
- 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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shopify_graphql-0.1.0.tar.gz.
File metadata
- Download URL: shopify_graphql-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f31281044c1b41ebfa58d93fc13d264df79a3fbcf0ea4b7f011922d40556308
|
|
| MD5 |
db9797b5ad48d1246930e824851c9922
|
|
| BLAKE2b-256 |
6906185e4bd4d6d31e03ebc8cc3e4cacd2d03286be3500009de696077c139e50
|
File details
Details for the file shopify_graphql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shopify_graphql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8578f19b016c56380080dd56ce79506a7d9956cb417338d27317264d807b8618
|
|
| MD5 |
4ad5b1b6ed73abcf1b360ab6f4f53967
|
|
| BLAKE2b-256 |
547e282c7cf3bbfbb22479caf5aaaf57834c1738b03287cc86a53a6c4fa649c1
|