AI workflow: start, material collection, workspace and templates

Structure of the AI workflow engine, the start checks and the preflight, profiles and autonomy modes, the scope of attachments and workspace, uploads, type templates and background execution.

The AI workflow controller uses the workflow engine to plan steps from the user's prompt (and attachments), chooses a model per capability from the existing AI settings (capability scopes), has the scheduler run the steps and gives a consolidated answer at the end. Long AI calls never run inside the web request.

Data model

Table names carry the installation's own prefix in the database.

TableRole
gpt_runrun: user, prompt, profile, mode, workspace, limits, state
gpt_step, gpt_dependencysteps and their dependencies
gpt_attachment, gpt_sourceattachment references and sources
gpt_templatetype templates (delete: status = 9)
aiconfigmodel assignment per capability
aiusageusage and cost
cron_queuegpt_workflow rows

Further run tables: gpt_message, gpt_conversation, gpt_followup, gpt_decision, gpt_normalization, gpt_cooldown. The workflow SQL lives in the engine library; the owning model is the workflow module's own model.

Start (start, POST only)

  1. Entity decoding of the prompt; an empty prompt or one over 100,000 characters is an error.
  2. Material collection: document centre files with roles, business objects, an earlier run's result — only data of allowed companies, the rest silently left out.
  3. Preflight (key, budget, model name); on failure the run does not start (PREFLIGHT_FAILED).
  4. Profile: rule-based choice for auto; profiles economy, standard, precise, maximum, research. Autonomy: strict, advisory, autonomous.
  5. Workspace: client, storage account, drive, folder, type code. Optional limits: steps, iterations, API calls, tokens, cost, parallelism, provider and model, web and deep research.
  6. Run and attachment references inserted, then the gpt_workflow job queued. Reply: run and trace ID, the skipped (0-character) attachments and the preflight warnings.

Upload and templates

  • upload: one file into the document centre folder of the run's (or the form's) workspace through the document store's addDocument; the reply is the document ID. Without a storage rule (gpt_workflow or document object storage) an error.
  • templatesave: saves the questionnaire (prompt, profile, options, research, expected material roles) as a type, updating the same code, read back; empty name: error_template_name. templatedelete: status = 9.

Background execution

A gpt_workflow row → processForCronqueue of the catalog task controller: runs the run's steps in time slices with atomic step claiming; the engine requeues itself while work remains. Accelerating entry points: the task controller's run slot endpoint with a secret (own slot lock, parallel steps) and a worker started from the framework's scheduler list, which fires N slot requests without waiting. Providers: OpenAI, Anthropic, Gemini.

Permissions

  • execute (permission input only) before calling the engine; start and setmodel require POST (BAD_REQUEST). template for types.
  • For the workspace the client only within content scope, the storage account only within the storage account scope, the type code only an existing active template.
  • The start form's type templates are only loaded with execute.