Skip to content

Data Agent integration overview ​

Applies to HENGSHI SENSE 7.0. Every integration calls the HENGSHI conversation service. The server runs model/tool loops, checks permissions, persists history, and manages tasks. Customers do not deploy a Node Agent service or store model secrets in the browser.

Choose an integration ​

NeedChoiceHENGSHI providesCustomer owns
Reuse the complete ChatBI page in a portaliframePage, questions, and resultsEmbedding layout, login, and browser embedding policy
Keep your page and embed a complete conversation UIComplete UI SDKShadow DOM chat, charts, history, and interactionsContainer, user authentication, and explicit scope
Build your own UIData client SDKHTTP/SSE client and conversation/run/clarification/confirmation APIsEvents, rendering, recovery, and interactions
Call from a business backend or another systemHTTP APIConversation service and structured streaming protocolUser identity mapping, requests, protocol handling, and business integration

The UI SDK and data client SDK are separate scripts; normally load only the one you need. Match the SDK asset version to your HENGSHI deployment and obtain the assets from its /assets/ directory (see Getting the SDK files and version for the version lookup). Internal monorepo package names are not public npm installation instructions.

Ask (read_only) and Act (authoring) are the two product execution modes. These are product execution modes, not a choice of browser Agent versus Java Workflow. Create a new conversation when changing mode or query scope.

Integration prerequisites ​

  1. Confirm Data Agent licensing, runtime services, and Responses model configuration.
  2. Confirm the user can access target resources in HENGSHI. Resource IDs, clientContext, and mode parameters do not grant permissions.
  3. Establish a browser login session, or let your trusted backend provide a short-lived credential authorized for the current user. Do not put a clientSecret, administrator credential, or model API Key in frontend code.
  4. Set an explicit baseUrl, such as https://analytics.example.com. This is the HENGSHI service URL, not the model URL. The default API prefix is /api.
  5. Configure CORS before testing cross-origin SDK calls.
  6. Load the SDK file from the deployment's /assets/ that matches its version; see Getting the SDK files and version for the version lookup.

Getting the SDK files and version ​

SDK files are static assets shipped with the HENGSHI deployment. They live under /assets/ on the deployment domain, and the file name carries the build version. The 7.0 UI no longer displays the SDK URL; obtain it as follows.

FilePurpose
/assets/hengshi-copilot@<VERSION>.jsComplete UI SDK, exposes window.Copilot
/assets/hengshi-data-agent-client@<VERSION>.jsData client SDK, exposes window.HengshiDataAgent

Read the build version from the deployment's About endpoint; no login is required:

bash
curl https://analytics.example.com/api/configurations/about
# {"data":{"version":"7.0-SNAPSHOT@5d5afa9#54aafd6", ...}}

Use the part of version before @ as <VERSION> (7.0-SNAPSHOT above), then build the script URL:

html
<script src="https://analytics.example.com/assets/hengshi-copilot@7.0-SNAPSHOT.js"></script>
<script src="https://analytics.example.com/assets/hengshi-data-agent-client@7.0-SNAPSHOT.js"></script>
  • The file name uses the version captured at build time. For nightly or trial builds, do not infer it from the "V 7.0" shown in the UI; if the build pipeline rewrites the version (release line or build number), use the value returned by the About endpoint.
  • SDK files must match the deployment version; read the version again after an upgrade.
  • With a split frontend/backend or CDN deployment, the script URL uses the CDN's assets/ path; still point baseUrl at the HENGSHI service.

CORS configuration ​

In System settings → Environment variable configuration, configure the actual portal origin. An origin contains scheme, host, and port only, such as https://portal.example.com, with no path. CORS is disabled by default.

Environment variableGuidance
SECURITY_CORS_CONFIG_ACCESS_CONTROL_ALLOW_ORIGINOne exact portal origin; do not use a comma-separated list. For multiple business systems, see "Multiple business systems / origins" below
SECURITY_CORS_CONFIG_ACCESS_CONTROL_ALLOW_METHODSRequired methods and OPTIONS, commonly POST,GET,PUT,OPTIONS,DELETE
SECURITY_CORS_CONFIG_ACCESS_CONTROL_ALLOW_HEADERSPreserve existing entries and add actual request headers; Bearer authentication requires Authorization
SECURITY_CORS_CONFIG_ACCESS_CONTROL_ALLOW_CREDENTIALStrue for Cookie authentication; the origin must then not be *

The UI SDK sends Accept-Language, X-CSRF-Token, X-Request-Domain, and X-Request-Hash-Url, and may send X-Request-Proxy when using a proxy. Data client authentication and CSRF headers belong to the caller. Allow Content-Type and any custom headers as needed. Preserve existing allowed headers to avoid disrupting other integrations.

Use browser Network tools to verify both the OPTIONS preflight and the actual request. credentials: 'include' does not bypass third-party Cookie restrictions; the login solution must account for Cookie attributes and browser policy. CORS permits an origin to call the service; it does not grant resource access or replace iframe CSP/embedding policy.

Multiple business systems / origins ​

Data Agent shares its ingress and CORS preparation with dashboard, published-page, and other embedding forms; see multiple business systems and cross-origin configuration for the origin whitelist and same-origin proxy patterns.

Permissions and page context ​

A read-only conversation locks one application/data package, one measure subject, or one saved dashboard, and a model profile identity; revision is audit metadata. Multiple datasets must belong to the same application. Cross-application or multiple independent subject analysis is unsupported.

clientContext is a bounded hint for the page, resource location, and view state. Do not send DOM, Cookies, Tokens, tenant, role, or permission assertions. Model configuration changes take effect on the next turn; if the profile is disabled or unavailable, history remains readable, and the profile must be restored or a new conversation created before continuing.

Query scope in embeds ​

The 7.0 standalone SDK does not expose the scope picker yet; provide the page scope through the host's userConfig.dataSources:

js
new Copilot(container, {
  executionMode: 'read_only',
  userConfig: { dataSources: [{ dataAppId: 620, datasetId: 12 }] },
});
  • userConfig.dataSources is the host's default scope; permissions are still enforced by the server.
  • Without a host scope and with server-side SCOPE_OPTIONAL on, the conversation runs against all data the user can access; when the setting is off, the host must provide a scope.
  • showDataSourcePicker and allowDataSourceRemoval have no effect in the current version.
  • Published App Market applications and dashboard interpretation use the fixed scope from the host page context.

Dashboard write entries for embedded pages ​

The complete UI SDK hides dashboard write entries by default. Turn them on only when the host implements the corresponding write action:

js
new Copilot(container, {
  executionMode: 'read_only',
  allowAddToDashboard: true,   // answer chart -> dashboard, default false
  allowCreateDashboard: true,  // whole conversation -> dashboard, default false
});
  • allowAddToDashboard gates both the answer-chart insert action and the dashboard add action registered by the host page; neither renders while it is off.
  • allowCreateDashboard gates the generate-dashboard entry in the prompt input; the host still has to provide the write implementation.
  • Both options default to false, and read-only consumption surfaces such as App Market, share links and app portals never offer them.

Migrating integrations to 7.0 ​

Remove dependencies on browser model loops, Node Agent CLI, legacy Workflow tuning, and DOM/action bridges. Legacy copilotMode: 'agent' | 'workflow' is read-only compatibility input, not runtime selection. The complete UI SDK supports both Q&A and operations: it defaults to read_only, and switches to authoring when the host sets executionMode: 'authoring' (or enables showModeSwitch so the user chooses). Operations still respect server-side permission checks and the confirm button in the answer.

headless: true only starts the complete UI hidden; it is not the data client SDK. Answer again uses the normal new-turn API; the legacy regenerate endpoint is no longer used. See AI deployment and upgrade for configuration migration.

User Manual for Hengshi Analysis Platform