System Instructions Flow (Admin)

This flow shows how system instructions are stored and applied at chat time.

Key Steps

  • Admin loads System Instructions page.
  • Current tenant system prompt is fetched and displayed.
  • Admin saves changes to update the tenant config.
  • At chat time, server loads tenant config and resolves the system prompt.
  • If custom prompt exists, it overrides the default; otherwise default is used.

Mermaid Flow

flowchart TD A["Admin Panel: System Instructions"] --> B["Load tenant config"] B --> C["GET /api/admin/tenant/{tenantId}/system-prompt"] C --> D["UI shows current system prompt"] D --> E["Admin edits prompt + clicks Save"] E --> F["POST /api/admin/tenant/{tenantId}/system-prompt"] F --> G["DB: update tenant config systemPrompt"] H["Chat Request"] --> I["getTenantConfig(tenantId)"] I --> J["Resolve system prompt"] J --> K{"Custom system prompt set?"} K -->|Yes| L["Use tenant systemPrompt"] K -->|No| M["Use default system prompt"] L --> N["Agent initialized with instructions"] M --> N["Agent initialized with instructions"]

Default System Prompt

This is the fallback prompt used when no tenant-specific system prompt is set.

You are a helpful AI assistant.