Skip to content

AI Studio Overview & 7 Agent Profiles ​

DX-OS AI Studio (@latticedx/plugin-dxos-ai) operates at Plane #5 of the LatticeDX 6-Plane architecture. It coordinates multi-role enterprise agents, enforces audited tool execution, and exposes standardized Model Context Protocol (MCP) and Agent-to-Agent (A2A) gateways. Rather than running as a separate service detached from authorization rules, AI Studio inherits caller identity from Keycloak OIDC, enforces ldx_* role policies, and executes queries inside PostgreSQL FORCE ROW LEVEL SECURITY transactions (app.current_org).

Each AI agent is stored in the latticeAiProfiles collection, synchronized bidirectionally with the NocoBase 2.2.50 host runtime (aiEmployees and rolesAiEmployees), and scoped to explicit tool modes, portal bindings (/p/*), and internal MCP servers.

DX-OS AI Studio Runtime Architecture ​

The interactive diagram below traces how user prompts and automation triggers route through the 7 starter profiles, the ReAct reasoning loop, the 20 Unified Tools, App Builder 2.0, and external MCP/A2A consumers.

DX-OS AI Studio, MCP/A2A Ingress & App Builder 2.0
INGRESS CHANNELSGOVERNANCE GATE, REACT LOOP & AUDITED PERMISSION SPLIT (PG16 RLS)ALLOWWriteAdvisoryASKAuditedPortal Chat &FlowSSE surfaceEventsai.agent / ai.llmMCP Gateway/api/dxos-mcp/api/dxos-mcp/it-otA2A Gateway/.well-known/agent-card.jsonGovernance & PII7 Profiles · Quota9 PII Regex GuardLLM & ReAct Loopag/gemini-3.8-flashmaxTurns <= 12Advisory MemorylatticeAiMemoryadvisory="true" · RLSALLOW: AuditedToolscreateAuditedToolPG16 RLS · 20+4 ToolsASK: Approval QueuelatticeAiApprovalQueueHuman-in-the-LoopAudit & OTelGenAIlatticeAiAuditLogslatticeAiTraces :4318HITL Decide:approveAction:rejectAction
InspectorGovernance & PIIClick any component to inspect bindings & boundaries
Role
Profile RBAC lock, persistent quota enforcement, and 9-rule PII redaction gate
Package / Port
ai-schemas.js · ai-governance.js
Protocol
enforceProfileRoleLock + checkAndConsumeAiQuotaPersistent
Payload / Schema
7 profiles | orgDailyCalls=5000 | userDailyCalls=500 | $50/d | 9 PII regex
Responsibilities
Locks dxos-architect to [root, admin], enforces daily call/token/USD quotas, and masks JWTs, sk-* keys, emails, IBANs, CCCD, phone, and tax IDs.
Chat/LatticeFlow, MCP Gateway, and A2A Gateway converge through Profile/Quota/PII governance into the ReAct loop. ALLOW calls execute via createAuditedTool + PG16 RLS alongside Advisory Memory; ASK mutations pass through HITL approval before audited execution and OTel GenAI tracing (:4318). App Builder 2.0 branches strictly forward into 4 independent lifecycle actions.

Runtime privileges are split across two distinct security tiers:

  • Operational agents (6 profiles): Operate within business role boundaries (ldx_*), read and write only RBAC-permitted collections, and pause behind Human-in-the-Loop (HITL) approval gates for record mutations or IIoT alarm actions.
  • Platform architect (dxos-architect): The sole administrative builder profile allowed to invoke the 11 ADMIN_BUILDER_TOOL_NAMES, strictly locked to root and admin callers.

LLM Provider Abstraction & Quick-Connect ​

All agent profiles route inference through NocoBase llmServices records managed by ai-llm-health.js. During initial bootstrap (ensureDefaultAiWorkforce), all 7 starter profiles bind to local-9router (an OpenAI-compatible router at AGENT_BASE_URL, defaulting to http://host.docker.internal:20128/v1) using ag/gemini-3.8-flash or combo.

Administrators can connect and rebind the entire starter workforce to external or local providers using 7 built-in presets (QUICK_CONNECT_PROVIDER_PRESETS):

Preset KeyStored ProviderDefault Service NameDefault Base URLDefault ModelAPI Key Required
9routeropenai-completionslocal-9routerhttp://127.0.0.1:20128/v1ag/gemini-3.8-flashYes
openaiopenaiquick-openaihttps://api.openai.com/v1gpt-4o-miniYes
openai-completionsopenai-completionsquick-openai-completionshttp://127.0.0.1:20128/v1ag/gemini-3.8-flashYes
google-genaigoogle-genaiquick-google-genaihttps://generativelanguage.googleapis.comgemini-2.5-flashYes
anthropicanthropicquick-anthropichttps://api.anthropic.com/v1claude-3-5-sonnet-latestYes
deepseekdeepseekquick-deepseekhttps://api.deepseek.com/v1deepseek-chatYes
ollamaollamaquick-ollamahttp://127.0.0.1:11434llama3.1No

SSRF Protection on LLM Endpoints ​

Every baseURL submitted to quickConnectLlm or probed by checkLlmHealth is validated by validateQuickConnectBaseUrl and assertSafeLlmProbeUrl:

  • Only http:// and https:// schemes are accepted; embedded username:password@ credentials are rejected.
  • Private RFC1918 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10), IPv6 link-local/ULA ranges (fe80::/10, fc00::/7), and cloud metadata endpoints (169.254.169.254, metadata.google.internal, metadata.azure.com) are blocked, including DNS resolution checks to prevent DNS rebinding.
  • Plain http:// is permitted only for QUICK_CONNECT_LOCAL_HOSTS (127.0.0.1, localhost, ::1, host.docker.internal) with local-capable providers (ollama, 9router, openai-completions) on ports 11434, 20128, 1234, 8000 (extendable via DXOS_LOCAL_LLM_PORTS).

Profile Schema & Security Controls ​

The latticeAiProfiles collection stores per-agent definitions under tenant RLS (organizationId) and enforces three server-side safety invariants before persistence or host synchronization.

latticeAiProfiles Schema Fields
ParameterTypeDefaultDescription
usernamerequired
string—Unique agent identifier matching ^[a-z0-9][a-z0-9_-]{1,62}$.
nicknamerequired
string—Display name shown in portal chat drawers (max 120 chars).
position
string—Operational role title presented to end users.
departmentScope
stringgeneralLogical department or domain boundary.
organizationIdrequired
string—Owning tenant identifier enforced by FORCE RLS.
llmService
stringlocal-9routerTarget service name in llmServices.
modelName
stringag/gemini-3.8-flashModel identifier routed through the selected LLM service.
isAdminBuilder
booleanfalseAutomatically forced to true if any ADMIN_BUILDER_TOOL_NAMES entry is enabled.
allowSubAgentDispatch
booleanfalseEnables sub-agent delegation tools (enabled only on dxos-coordinator).
allowedRoles
jsonb[ldx_employee, ldx_manager]Business roles permitted to invoke this profile; locked to [root, admin] when isAdminBuilder=true.
toolPermissions
jsonb{}Map of toolName to ALLOW, ASK (HITL), or OFF.
mcpServers
jsonb[]Attached MCP server descriptors validated against SSRF via validateMcpServerUrl.
portalBindings
jsonb[]Portal slugs (/p/<slug>) or ['*'] where this agent appears.

Fail-Closed Role and Access Guards ​

Guard LayerEnforcement Behavior
Builder privilege lock (enforceProfileRoleLock)Whenever isAdminBuilder is true or any of the 11 administrative builder tools is enabled in toolPermissions, ai-sync.js and the latticeAiProfiles.beforeValidate hook force allowedRoles to ['root', 'admin'].
New-role isolation (roles.afterCreate)When a new business role is created, plugin-dxos-ai immediately removes any auto-generated rolesAiEmployees bindings targeting profiles where isAdminBuilder is true.
Direct REST protectionMiddleware dxosAiProfileScope blocks direct non-admin queries on latticeAiProfiles (including chart aggregation queries via charts:queryData) and scopes admin reads to actor.organizationId.

Complete Catalog of the 7 Agent Profiles ​

All 7 starter profiles (STARTER_AI_BLUEPRINTS in ai-schemas.js) are seeded and kept synchronized by dxosAi:bootstrapDefaults.

#usernameRole & ScopePortal BindingsAllowed Roles (allowedRoles)Sub-Agent & MCP
1dxos-coordinatorCentral Multi-Agent Orchestrator (enterprise-wide)['*']root, admin, ldx_admin, ldx_director, ldx_manager, ldx_employee, ldx_warehouse, ldx_dispatcher, ldx_driverallowSubAgentDispatch: true · dxos-it-ot-mcp
2dxos-architectSystem & Block Architect (platform-admin)['*']['root', 'admin'] (isAdminBuilder: true)dxos-it-ot-mcp
3dxos-opsCold-Chain & IoT Incident Engineer (operations-itot)['incidents', 'procurement']root, admin, ldx_admin, ldx_director, ldx_manager, ldx_employee, ldx_warehousedxos-it-ot-mcp
4dxos-logistics5-Step Cold-Chain Logistics Coordinator (logistics-5step)['logistics']root, admin, ldx_admin, ldx_director, ldx_manager, ldx_employee, ldx_warehouse, ldx_dispatcher, ldx_driverdxos-it-ot-mcp
5dxos-workspaceInternal Services, Procurement & P.A.R.A. Assistant (workspace-para)['services', 'procurement']root, admin, ldx_admin, ldx_director, ldx_manager, ldx_employeeNone
6dxos-operatorIT/OT Operations Execution Specialist (operations-execution)['incidents', 'logistics', 'services']root, admin, ldx_admin, ldx_director, ldx_manager, ldx_operator, ldx_dispatcher, ldx_warehousedxos-it-ot-mcp
7dxos-analystCross-Department BI & GraphRAG Analyst (analytics-bi)['*']root, admin, ldx_admin, ldx_director, ldx_manager, ldx_employeeNone

Tool Permission Matrix (ALLOW / ASK) Across All 7 Profiles ​

Tools marked ALLOW execute immediately after RBAC and tenant RLS verification. Tools marked ASK enqueue a human approval item in latticeAiApprovalQueue or require explicit user confirmation before execution.

Profile (username)ALLOW ToolsASK Tools
dxos-coordinatordxos_search_enterprise_context, dxos_my_workflow_tasks, dxos_graph_impact_analysis (plus dispatch-sub-agent-task, list-ai-employees, get-ai-employee)dxos_execute_record_action, dxos_orchestrate_enterprise_case, dxos_alarm_action
dxos-architectdxos_inspect_architecture, dxos_recommend_page_blueprint, dxos_design_creative_block, dxos_compose_page_blocks, dxos_snapshot_or_rollback_page, dxos_provision_role_workspace, dxos_manage_portal_and_acl, dxos_extend_collection_schema, dxos_manage_rbac_permissions, dxos_deploy_workflow, dxos_configure_workflow, dxos_search_enterprise_context, dxos_orchestrate_enterprise_case, dxos_graph_impact_analysis, dxos_memory_remember, dxos_memory_recalldxos_memory_forget
dxos-opsdxos_search_enterprise_context, dxos_my_workflow_tasks, dxos_graph_impact_analysisdxos_execute_record_action, dxos_orchestrate_enterprise_case, dxos_alarm_action
dxos-logisticsdxos_search_enterprise_context, dxos_orchestrate_enterprise_case, dxos_graph_impact_analysisdxos_execute_record_action, dxos_my_workflow_tasks
dxos-workspacedxos_search_enterprise_context, dxos_my_workflow_tasks, dxos_graph_impact_analysisdxos_execute_record_action, dxos_orchestrate_enterprise_case, dxos_alarm_action
dxos-operatordxos_search_enterprise_context, dxos_my_workflow_tasks, dxos_memory_recall, dxos_memory_rememberdxos_execute_record_action, dxos_alarm_action
dxos-analystdxos_search_enterprise_context, dxos_graph_impact_analysis, dxos_orchestrate_enterprise_case, dxos_memory_recall—

Profile & LLM Management APIs ​

The dxosAi resource exposes dedicated actions for profile governance, portal discovery, and LLM health management.

GET/api/dxosAi:listProfiles
Bearer JWT | ldx_pat_*admin
Returns all tenant AI profiles, active organizations, and available tool catalog metadata.
POST/api/dxosAi:saveProfile
Bearer JWT | ldx_pat_*admin
Creates or updates an AI profile, enforces enforceProfileRoleLock, and syncs to aiEmployees.
POST/api/dxosAi:bootstrapDefaults
Bearer JWT | ldx_pat_*admin
Seeds or restores all 7 starter AI profiles and binds them to the active default LLM service.
GET/api/dxosAi:portalAgents
Bearer JWT | ldx_pat_*loggedIn
Lists enabled AI profiles visible to the caller's roles on the requested portalSlug.
POST/api/dxosAi:quickConnectLlm
Bearer JWT | ldx_pat_*admin
Configures an LLM provider preset (OpenAI, Gemini, Anthropic, DeepSeek, Ollama, 9router) and rebinds starter agents.
bash
curl -X POST "https://app.example.com/api/dxosAi:quickConnectLlm" \
  -H "Authorization: Bearer <ADMIN_JWT_OR_PAT>" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "google-genai",
    "modelName": "gemini-2.5-flash",
    "apiKey": "AIza...",
    "testConnection": true,
    "verifyCompletion": true
  }'

Additional LLM service actions include GET /api/dxosAi:checkLlmHealth, GET /api/dxosAi:listLlmServices, POST /api/dxosAi:switchLlmServiceModel, and POST /api/dxosAi:deleteLlmService. Deleting a bound LLM service automatically clears llmService and modelName references on affected latticeAiProfiles and aiEmployees records.

Apache-2.0 · LatticeDX v0.4.2 · Powered by NocoBase · v2.2.50 · Apache-2.0 (Clause 5.2)