Shopify Tool
This tool acts as a custom app for Shopify stores, allowing the Agent to execute GraphQL queries to gather information or perform mutations against the Shopify store.
Usage
This tool has more extensive example usage documented in a Jupyter notebook here
In particular, the tool is very effective when combined with a method of retrieving data from the GraphQL schema definition.
pip install llama-index llama-index-readers-file llama-index-tools-shopify unstructured
from llama_index.tools.shopify import ShopifyToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.readers.file import UnstructuredReader
from llama_index.core.tools.ondemand_loader_tool import OnDemandLoaderTool
documentation_tool = OnDemandLoaderTool.from_defaults(
UnstructuredReader(),
name="graphql_writer",
description="""
The GraphQL schema file is located at './data/shopify_graphql.txt', this is always the file argument.
A tool for processing the Shopify GraphQL spec, and writing queries from the documentation.
You should pass a query_str to this tool in the form of a request to write a GraphQL query.
Examples:
file: './data/shopify_graphql.txt', query_str='Write a graphql query to find unshipped orders'
file: './data/shopify_graphql.txt', query_str='Write a graphql query to retrieve the stores products'
file: './data/shopify_graphql.txt', query_str='What fields can you retrieve from the orders object'
""",
)
shopify_tool = ShopifyToolSpec(
"your-store.myshopify.com", "2023-04", "your-api-key"
)
agent = FunctionAgent(
tools=[*shopify_tool.to_tool_list(), documentation_tool],
llm=OpenAI(model="gpt-4.1"),
system_prompt=f"""
You are a specialized Agent with access to the Shopify Admin GraphQL API for this Users online store.
Your job is to chat with store owners and help them run GraphQL queries, interpreting the results for the user
You can use graphql_writer to query the schema and assist in writing queries.
If the GraphQL you execute returns an error, either directly fix the query, or directly ask the graphql_writer questions about the schema instead of writing graphql queries.
Then use that information to write the correct graphql query
""",
)
print(await agent.run("What products are in my store?"))
run_graphql_query: Executes a GraphQL query against the Shopify store
This loader is designed to be used as a way to load data as a Tool in a Agent.
Metadata
Release files for llama-index-tools-shopify 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_tools_shopify-0.6.0.tar.gz | 4.4 kB | Without provenance | Details for llama_index_tools_shopify-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_tools_shopify-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_tools_shopify-0.6.0-py3-none-any.whl |
Total release size: 8.4 kB
Release files / llama_index_tools_shopify-0.6.0.tar.gz
| Download URL | llama_index_tools_shopify-0.6.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d960f86e4755552407b7eac8f2fb1c14a64ded8acb7b3f0b58e5175959be1a5
|
|
BLAKE2b-256 checksum How to use checksums |
ef678fbd0d0b168cb7d663b1d3f2dba7f919a40d4ce0135ed484dd27fa925088
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_tools_shopify-0.6.0-py3-none-any.whl
| Download URL | llama_index_tools_shopify-0.6.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92f89a9689ee3ec6de5192aea40e6cb76e88d3620985291b19153f185a9c69f8
|
|
BLAKE2b-256 checksum How to use checksums |
cc0471b212ee97370b6563fdaae8b589397dd3f91a28fceaa1cd3fb9c3c3f549
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-tools-shopify 0.6.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.