AutoBlocks includes bounded AI assist inside the product app only. AI helps you draft and understand AutoBlocks mapped to Phase 1 constructs — it does not run arbitrary code, access unsupported integrations, or change your account silently.
API routes: apps/api/src/modules/ai/routes.ts. Package: packages/ai-assist. Product UI: apps/product-web/src/features/ai-assist/.
Help chat on marketing (POST /help/chat) is separate — public, corpus-grounded, no tenant access. See Marketing site and help chat.
What AI can do
| Capability | Endpoint | When to use |
|---|---|---|
| Draft | POST /tenants/:tenantId/ai/draft | Describe a new AutoBlock in plain language |
| Refine | POST /tenants/:tenantId/ai/refine | Adjust an in-progress wizard draft |
| Repair | POST /tenants/:tenantId/ai/repair | Fix validation errors after a failed save |
| Explain | POST /tenants/:tenantId/ai/explain | Understand what an existing AutoBlock does |
All four require authentication and tenant membership.
What AI cannot do (Phase 1)
| Unsupported | System behavior |
|---|---|
| Custom scripting | Rejected with clear message |
| Arbitrary HTTP to unknown services | Only outbound_webhook steps |
| Silent auto-save | You review every suggestion |
| Access other tenants' data | Tenant-scoped requests only |
| Run automations on your behalf | AI assists setup, not execution |
AI assist flow
sequenceDiagram
participant You
participant Panel as AiAssistPanel
participant API
participant Provider as OpenAI or fallback
You->>Panel: Enter intent or edit request
Panel->>API: POST /tenants/:id/ai/draft
API->>Provider: Bounded prompt + schema
Provider-->>API: RoutineDraft JSON
API-->>Panel: Draft with trigger + steps
Panel-->>You: Review in wizard
alt Accept
You->>API: POST /routines
else Reject / edit manually
You->>Panel: Manual wizard edits
end
Timeout: AI_TIMEOUT_MS — slow responses return HTTP 504 ai_timeout.
Entry points in the product
| UI location | Behavior |
|---|---|
/onboarding — AI path | Full draft during first-run |
/routines/new?ai=1 | AI-first creation |
| Routines list — New with AI | Same as above |
| Wizard inline panel | Refine while editing |
| Detail view | Explain existing AutoBlock |
Component: apps/product-web/src/features/ai-assist/AiAssistPanel.tsx.
Supported output shape
AI maps intent to the same types as manual creation:
| Field | Allowed values |
|---|---|
| Trigger kind | manual, schedule, inbound_webhook |
| Step kind | notification, outbound_webhook, storage |
| Rules | equals, contains, greater_than |
Provider logic: packages/ai-assist/src/provider.ts.
Review before save (required)
| Principle | Practice |
|---|---|
| Trust over magic | Read every step label and config |
| You stay in control | Reject AI output and edit manually |
| Validate in wizard | Invalid drafts show inline errors |
| Repair loop | Use repair endpoint for targeted fixes |
flowchart LR
Draft["AI draft"]
Review["You review"]
Edit["Manual edit"]
Save["POST /routines"]
Reject["Discard AI"]
Draft --> Review
Review -->|OK| Save
Review -->|Not OK| Edit --> Save
Review -->|Wrong| Reject --> Edit
Auth and privacy
| Topic | Detail |
|---|---|
| Auth | Session cookie required |
| Tenant scope | :tenantId must match your workspace |
| Data sent to model | Routine intent + draft JSON — not billing secrets |
| Help chat contrast | Public, no login, no tenant data |
Error handling
| HTTP | Error | User action |
|---|---|---|
| 400 | invalid_request | Fix input and retry |
| 403 | Tenant mismatch | Re-login |
| 504 | ai_timeout | Shorten request or retry |
| Validation on save | required, min_items | Use repair or manual fix |
Client validation: apps/product-web/src/features/ai-assist/api-client.ts.