Best practices
Satia is an AI-Native Business Operating System. Whether you are operating from Sati or from an external AI agent via MCP (Claude Code, Cursor, Codex, Windsurf, or Antigravity), following the right architectural sequence is the difference between a fragile/slow setup and a fast, reliable, auditable business operation.
1. Mandatory Building Sequence: Database-First, Exterior-Last
Never start by building a custom view (custom_views), a Python automation script (automation_scripts), or an external channel integration before the underlying business tables and columns exist and are validated in the database.
Strict 5-Step Construction Order:
- Step 1 — Inspect the Pre-Loaded Workspace Context:
- Your active workspace context (business tables in
business_tables_catalog, column schemas inunified_schema_markdown, document folders inknowledge_folders_directory, transactional agents intransactional_agents_directory, and internal staff) is already injected into your instructions. Use it directly without running redundant exploratory queries.
- Your active workspace context (business tables in
- Step 2 — Model the Database First (
system_delegation__delegate_to_schema_builder):- If business tables, columns, relationships (
relation), statuses (status), carts (line_items), or reactive calculated columns (formula/ conditionalROLLUP) are missing, delegate their creation in plain natural language to the Data Modeler (system_delegation__delegate_to_schema_builder). - When iterating on a schema request, pass the same
delegation_session_id. Once complete (or when operating via MCP), callworkspace__get_context(force_refresh=True)if needed to refresh the catalog of tableslugs and columns.
- If business tables, columns, relationships (
- Step 3 — Seed & Validate Real Records (
database__insert/database__query):- Insert realistic test records into the business tables using their
slugand verify that relationships, line items, and reactive formulas compute the expected values.
- Insert realistic test records into the business tables using their
- Step 4 — Build Knowledge, Agents, and Internal/Mobile Views:
- Create master playbooks and manuals in
knowledge_docs(organized insideknowledge_folders). - Configure transactional agents (
agents), their granular table/column permissions (agent_tables), and linked documents (agent_docs). - Build Custom Views and Micro-Apps (
custom_viewsandshared_view_linksviadatabase__insert,database__update, anddatabase__patch_text) following the Satia Design System. Remember that Custom Views run both on the web platform and natively inside the Satia Mobile App (window.satia.native).
- Create master playbooks and manuals in
- Step 5 — Connect External Integrations Last (Automations, Webhooks, Channels):
- Once tables, formulas, and views work internally, write and test external integration scripts (
automation__test_script→automation__save_script).
- Once tables, formulas, and views work internally, write and test external integration scripts (
2. Golden Rule: Prefer Asynchronous Event Automations (event) over Synchronous Agent Tools
One of the most common design mistakes is attaching multiple synchronous agent_tools to a conversational agent (WhatsApp, Instagram, Web) that call slow external APIs (electronic invoicing, legacy ERPs, email delivery, PDF generation) in the middle of a live customer conversation.
Why Table Event Automations (trigger_type="event") Are Superior:
| Criterion | ❌ Synchronous Agent Tool (agent_tools) | ✅ Asynchronous Table Event Automation (automation_scripts) |
|---|---|---|
| Chat Response Speed | Slow (the customer waits 5–30s while the external API responds). | Instant (<1–2s): the agent simply inserts/updates the row in the business table (e.g., pedidos). |
| Fault Tolerance | If the external API times out, the agent turn fails in front of the customer. | The record is safely persisted in the database first; the background worker executes the script with full logs and traceability in script_executions. |
| Omnichannel Triggering (Web + Mobile + Chat) | Only runs if the action happens inside a chat turn with that specific agent. | Fires automatically regardless of whether the record was created by a WhatsApp agent, a human operator in the web UI, a Custom View, or the Satia Mobile App. |
| AI Token Efficiency | Raw external API JSON payloads enter the LLM context on every turn. | Zero LLM tokens: runs in the Python execution engine and only notifies the agent (agents.trigger_conversation) when necessary. |
When SHOULD You Use an Agent Tool (agent_tools)?
Use agent_tools only when the conversational agent requires the live response from an external system within the exact same turn in order to reply to the customer (for example: checking live shipping carrier tracking not stored in Satia, or generating an instant checkout link when not driven by a table status change). For everything else (CRM sync, issuing electronic invoices, sending Slack/email alerts, updating external ERP inventory), have the agent write to the Satia business table and trigger a trigger_type="event" automation.
3. Native Reactive Formulas (formula & Conditional ROLLUP) vs. Python Scripts
- Never use a Python automation script (
automation_scripts) to calculate order totals, taxes, customer balances, stock counters, or status badges that can be expressed with aformulacolumn. - Satia's reactive formula engine runs natively inside the database and client UI: it recalculates in 0 ms on every insert or update, with zero async queues and zero risk of infinite update loops.
- If a table has a shopping cart (
line_items), its subtotal, tax, and total must beformulacolumns (e.g.,sum({{productos.total}})). - If you need to aggregate or look up values across related tables (e.g., a customer's accumulated balance, total non-canceled orders, or a contracted plan price), always delegate a cross-table
ROLLUP(including conditional filters such asestado != 'cancelado') tosystem_delegation__delegate_to_schema_builder.
4. First-Class Business Tables (slug)
In Satia, every business module (clientes, pedidos, productos, citas, facturas, etc.) operates as a first-class SQL table identified by its slug:
- ALWAYS use the business table's
slug(ortable_slugwhen linking views and schedules) and its declared column names directly across SQL (database__query,database__insert,database__update), Python (db.query,db.get,db.filter,db.insert,db.update), and Custom Views (window.satia.getEntities,createEntity,updateEntity). - Write all queries and mutations referencing only the columns listed in the table's schema (e.g.,
SELECT id, name, total, estado FROM pedidos WHERE estado = 'pagado'). Workspace isolation and role permissions are enforced automatically.
5. Surgical Editing & Context Economy
- Inspect Without Flooding Context (
database__inspect_text):- Whenever you need to inspect view code (
custom_views.code_content), automation scripts (automation_scripts.code), custom tool code (agent_tools.script_code), agent personalities (agents.personality), or long documents (knowledge_docs.content), never runSELECT code_contentor paginate withOFFSETloops. Usedatabase__inspect_textwithsearch_patternorstart_line/end_line.
- Whenever you need to inspect view code (
- Patch Instead of Rewriting (
database__patch_text):- To modify existing views, scripts, agent personalities, or documents, always use
database__patch_text. It is faster, consumes a fraction of the tokens, and prevents accidental truncation.
- To modify existing views, scripts, agent personalities, or documents, always use
- Human Attribution (
user_prompt):- Always pass the user's original instruction in
user_prompton every write or delete call soplatform_audit_logsrecords an accurate audit trail of who requested each change and why.
- Always pass the user's original instruction in
6. Official Web Platform Routes Reference
When guiding the user to perform an action in the Satia web interface, always point them to the exact route (never invent non-existent settings pages):
| Feature / Module | Web Platform Route | What the User Does There |
|---|---|---|
| Marketplace Templates (Browse & Install) | /templates | Browse and install ready-made industry solution templates from the main navigation. |
| Template Creator Studio | /settings/templates | Package workspace tables, agents, views, docs, and automations into a publishable template. |
| Automations, Secrets & Execution Logs | /automations | Configure encrypted automation_secrets, inspect script_executions logs and automation details, and toggle is_active on or off. |
| Billing, Wallet & Data Plans | /settings/billing | View wallet balance, manage Data Plan tiers, recharge credits, configure auto-recharge, and enable audit log retention add-ons. |
| Team & Staff Permissions (RBAC) | /settings/team | Invite team members and configure granular Staff access permissions (Accesos) per business table and system module. |
| Remote MCP & Personal Access Tokens | /settings/mcp | Generate/revoke Personal Access Tokens (satia_pat_...) and copy connection snippets for external MCP clients. |