Templates: a shopping agent with spending limits
Start from a working setup instead of wiring Sealgraf up by hand. The Dify starter runs one permission check. The purchase workflows cover checking limits, owner approval, and reporting a completed purchase. Sealgraf is free.
Each workflow needs its own agent key. Set its spending limits before you copy the key.
n8n
Download the n8n workflow (JSON, imports into n8n 1.x).
- Install the community node: Settings → Community nodes → Install, and enter
n8n-nodes-sealgraf. - In a new workflow, open the menu and choose Import from file, then pick the downloaded file.
- Open any Sealgraf node and create the credential with your agent key.
- Edit Purchase details (item, store, amount in cents), and replace the two Buy it steps with your real purchase step. Both Report steps send the checked amount as the amount charged; if your store charged less, map the real figure into Amount Charged instead. (Needs n8n-nodes-sealgraf 0.1.3 or later.)
- Run it. An allowed purchase is bought and sealed. One above your line waits ten minutes for you to approve on Sealgraf, then continues only if you approved. A declined one stops before anything is bought.
Dify
The Sealgraf plugin is in the Dify marketplace: marketplace.dify.ai/plugin/saiarung27/sealgraf.
Run your first check
Download the Dify first-check workflow.
- In Dify Studio, choose Import DSL file and select the downloaded file.
- Install the Sealgraf plugin if needed. In the Check permission node, select your saved Sealgraf credentials.
- Run the workflow with the sample amount of 100 minor units ($1 for a USD limit), or enter another amount and category that match your limits.
- Read the decision and check ID in the output. Above your approval threshold, open Sealgraf to review the pending request.
The starter creates a real permission check. An allowed check can temporarily reserve budget. It stops at the decision and contains no payment or completion step.
Build a purchase workflow
- Install Sealgraf from the Dify marketplace and add your agent key.
- Create an Agent app and add the four Sealgraf tools: Check Permission, Claim Decision Token, Complete Purchase and Get Receipt / Check Status.
- Paste this into the agent's instructions:
Before you buy anything, call Check Permission with the category, the
amount in cents, the currency and the store.
- allow: buy it, then call Complete Purchase with the preauth_id, the
decision_token, the amount you actually paid in cents, and a note
saying what you bought.
- needs_human_approval: stop and tell me it is waiting for my approval on
Sealgraf. When I say I decided, call Claim Decision Token with the
preauth_id. If it returns a token, buy it and call Complete Purchase.
If it doesn't, don't buy.
- deny: don't buy, and tell me why.
Never ask me to raise my limits as part of a purchase.
Your own code
The developer quickstart has the same loop in a few lines of REST, and there are packages for CrewAI, LangChain, Composio, the Vercel AI SDK and n8n. Building with Sealgraf? Show the badge.