Library / AI Agents & Assistants
AI Agents & Assistants
Orchestrate multi-store order allocation with OpenAI, Postgres, and Slack
When an API call/webhook arrives, it runs an AI agent with OpenAI / ChatGPT using Postgres, Slack.
What it does
## Multi-Store Inventory Orchestrator An AI agent fulfills one order across multiple stores/warehouses: it checks live stock, builds an allocation plan, and reserves stock idempotently — retrying with backoff and escalating to a human instead of guessing when a reservation can't be resolved cleanly. ### How it works 1. A webhook receives the new order and normalizes it, deriving an idempotency key and session ID. 2. Postgres dedupes retried/duplicate webhooks before they ever reach the agent. 3. An AI Agent (GPT‑4.1) with four tools — check stock, reserve, release, and check rate limits — decides which stores to use, builds the allocation plan, and reserves stock. 4. The agent's structured JSON decision is logged to Postgres for audit and replay. 5. Fully-reserved orders auto-confirm; partial or failed allocations go to Slack for human ops review, then get confirmed or cancelled based on that decision. ### Setup steps 1. Add HTTP credentials for each store's inventory API (or unified middleware) on the four tool nodes. 2. Add an OpenAI credential for the agent. 3. Add a Postgres credential and create the inventory_orders and inventory_reservations tables. 4. Add a Slack credential on the ops-review notification node. 5. Point the manual-resolution Wait node's resume webhook at your ops dashboard. ### Customization tips Send a test order split across 2+ stores, with one intentionally out of stock, to exercise the escalation path end-to-end.
The steps
- Webhook - New Order
- Set - Config
- Postgres - Check Idempotency
- IF - Already Processed
- NoOp - Duplicate Ignored
- Tool - Check Store Stock
- Tool - Reserve Stock
- Tool - Release Reservation
- Tool - Get Store Rate Limit Status
- OpenAI Chat Model
- Window Buffer Memory
- AI Agent - Inventory Orchestrator
- Set - Parse Agent Output
- Postgres - Log Order Decision
22 steps in total.
Similar automations
Tasks & Project ManagementOrchestrate HR onboarding and offboarding with Postgres, Slack, Google Workspace, Jira25 stepsTasks & Project ManagementOrchestrate employee onboarding across HR, IAM, IT and SaaS via webhook16 stepsBuilding Blocks & UtilitiesOrchestrate sequential Notion task execution for participants with webhooks53 stepsAI Agents & AssistantsOrchestrate a Multi-Agent AI Village with OpenAI36 steps