Order Entry
This flow represents the architecture of a conversational agent designed to assist in sales and order management processes, integrating query and write tools on Airtable-like databases.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
ChatInput-idt53[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Input]
style ChatInput-idt53 stroke:#a170ff
AdvancedAgent-slwuk[Agent]
style AdvancedAgent-slwuk stroke:#a170ff
GoogleGenerativeAIModel-t5o3f[Gemini]
style GoogleGenerativeAIModel-t5o3f stroke:#a170ff
Airtable-f9c4x[read]
style Airtable-f9c4x stroke:#a170ff
Airtable-pfewz[update]
style Airtable-pfewz stroke:#a170ff
ChatOutput-rxxgc[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-rxxgc stroke:#a170ff
Airtable-m6dwr[create]
style Airtable-m6dwr stroke:#a170ff
ChatInput-idt53 -.- AdvancedAgent-slwuk
linkStyle 0 stroke:#a170ff
GoogleGenerativeAIModel-t5o3f -.- AdvancedAgent-slwuk
linkStyle 1 stroke:#a170ff
Airtable-f9c4x -.- AdvancedAgent-slwuk
linkStyle 2 stroke:#a170ff
Airtable-pfewz -.- AdvancedAgent-slwuk
linkStyle 3 stroke:#a170ff
AdvancedAgent-slwuk -.- ChatOutput-rxxgc
linkStyle 4 stroke:#a170ff
Airtable-m6dwr -.- AdvancedAgent-slwuk
linkStyle 5 stroke:#a170ff
🧩 Overview
The workflow implements an AI‑powered sales assistant that handles product inquiries, checks real‑time inventory, proposes selections, confirms orders, updates stock, records the sale, and communicates the outcome to the user—all automatically and in a single conversational flow.
⚙️ Main Features
- Conversational interface that accepts user messages and replies in natural language.
- Gemini language model for intelligent decision‑making and tool selection.
- Airtable read tool that retrieves current product availability, pricing, and details.
- Airtable update tool that decrements inventory stock only after explicit confirmation.
- Airtable create tool that logs each order into the “Pedidos” table with all required fields.
- Automatic summary and confirmation of selected items before any database changes occur.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Receives the user’s natural‑language query and conversation context. | User message, conversation ID, session ID, optional attachments. | Structured message object. |
| Advanced Agent | Orchestrates the entire process, invoking the Gemini model and tools as needed. | User prompt (from Chat Input), configured LLM (Gemini), set of tools (read, update, create). | Final chat‑ready message. |
| Gemini | Generates the agent’s reasoning, selects appropriate tools, and crafts the response text. | Prompt text, system instructions (from the agent’s description). | LLM response message. |
Airtable – Read (read_productos) |
Retrieves product information from the “Productos” table to inform recommendations. | Filter criteria (product name, availability). | Product record set. |
Airtable – Update (update_records_productos) |
Adjusts the stock quantity of a product after the user confirms the purchase. | Record ID, new stock value. | Confirmation of stock update. |
Airtable – Create (write_records_pedidos) |
Creates a new order record in the “Pedidos” table once the user confirms. | Order details (product, quantity, price, customer, delivery address). | Confirmation of order creation. |
| Chat Output | Formats and sends the agent’s final response back to the user. | Final message text from the agent. | Delivered chat message. |
🧠 Notes
- The agent never alters the database unless the user explicitly confirms the order.
- The inventory check is mandatory before any recommendation; the system never invents product data.
- Order creation requires complete information (product, quantity, price, customer, delivery details); if any field is missing, the agent prompts the user before proceeding.
- The workflow relies on an Airtable base named “Gestión de Productos” with three tables: “Productos”, “Pedidos”, and (optionally) “Usuarios”.
- The Gemini model (
gemini-3-flash-preview) is configured with a high temperature (1.0) to encourage diverse reasoning while adhering to the system prompt. - All components are connected in a linear sequence: input → agent → model → tools (read → update → create) → output.
- The Label Component at the start merely displays the flow’s description and does not participate in data processing.