← Back to Technical blog

Technical article

Connecting External Agents to Enterprise BI: HENGSHI API, CLI, and Analytics Delivery Practices

Connect external agents through APIs, SDKs, CLI, and subscriptions while preserving metrics, identities, and actual execution states for verifiable analytical delivery.

Nov 17, 2026Technical blogHENGSHI12 min read
Agentic BIHENGSHI SENSE

Article body

Full article

When enterprises connect Dify, Coze, or their own agents to BI, they usually want a continuous process spanning data retrieval, analysis, dashboard delivery, and business follow-up. That process must preserve business definitions, time ranges, and execution identities across calls. It must also distinguish query results, saved assets, and later business-processing states to deliver outcomes that can be verified and reused.

HENGSHI Data Agent provides question understanding, analytical queries, and assisted authoring. APIs, SDKs, and embedding support different integration levels, while HENGSHI CLI offers programmatic entry points for BI operations such as queries, dashboards, and element configuration. External processes can reuse HENGSHI data models and metrics, organize analysis and asset creation, and connect to their business systems. Explicit calling identities, target objects, and result readback at each stage make actual completion easier to establish.

Founded in 2016 for the Data+AI era, HENGSHI has pioneered a new generation of Agentic BI. Its enterprise analytics platform, HENGSHI SENSE, works with the HENGSHI JARVIS digital employee, the HENGSHI CLI execution engine, and HENGSHI BOX, a privately deployed control hub, to form an integrated service portfolio. With a decade of BI expertise and its “Powered by Hengshi” ecosystem strategy, HENGSHI empowers software vendors across industries and provides enterprise groups in manufacturing, finance, retail, government, and other sectors with integrated AI analytics for business management and intelligent decisions, built on trusted data within their private environments.

1. Divide responsibilities between business workflows and analytical tasks

External agents can manage cross-system objectives, such as receiving a business-analysis request, gathering missing information, and coordinating approvals and tickets. HENGSHI handles BI capabilities including datasets, metrics, queries, analysis, and visualization. Both can involve intent understanding, but operate with different contexts and task scopes.

TaskHENGSHI capabilitiesExternal process priorities
Business questionsData Agent understands analytical questions and breaks down queriesCollect business objectives and decide when to enter analysis
Data calculationsQuery and analyze under configured models, metrics, and permissionsPass the correct context and retain results and status
Analytics deliveryAssist chart and dashboard authoring and expose programmatic resource operationsOrganize review and determine saving targets and delivery methods
Result distributionNative subscriptions can push dashboards and other content on a scheduleCoordinate cross-system approvals, tickets, and follow-up execution when needed

Integration therefore need not translate every natural-language request into a low-level query before handing it to HENGSHI. Conversational tasks can use the relevant Agent capabilities; tasks with fixed definitions and clear output can use existing metrics or data interfaces. Select a path according to actual interface contracts and deployment capabilities.

2. Choose APIs, SDKs, and CLI according to the delivery objective

Different integration methods address different interaction and execution needs. HENGSHI offers iframes, a JS SDK, and APIs. Its CLI organizes operations such as data integration, queries, dashboards, element configuration, and permissions into callable commands.

Integration methodSuitable objectivesWhat to confirm
iframe / JS SDKPresent analytics pages, dashboards, or related interactions in business systemsEmbedding scope, session authentication, page context, and user experience
APICall exposed query, analysis, or resource capabilities from a serverActual parameters, results, identities, and error handling
CLI + skillsLet agents or scripts perform reviewable, repeatable BI operationsInstance and identity, resource location, supported commands, and before/after verification
Native subscriptions / WebhookDistribute existing dashboard content on a schedule or immediatelyPush identity, recipient mapping, data scope, and delivery records

APIs and CLI should not be reduced to “data only” and “resources only.” Their actual coverage depends on the version and its command and interface documentation. SDK returns should not be assumed to be standard configurations for arbitrary third-party chart libraries; external interfaces must follow the actual contract.

For agent execution, HENGSHI CLI skills turn context reading, capability selection, execution order, and verification into reusable processes. They let agents perform BI operations through stable entry points and reduce ad hoc guesses about interfaces and object relationships.

3. Establish identity for every call; filters cannot replace permissions

After an external user enters the analysis process, establish whose identity executes subsequent calls. Calls as an end user should follow that user’s permissions. Calls as a service identity require a predefined account scope and suitable scenarios. Names, tenants, or roles supplied in a chat are not trusted authorization evidence.

HENGSHI APIs support authentication through ClientID, Secret, AccessToken, and related mechanisms. Explicitly configured Sudo capabilities can execute calls as other platform users. Trusted backend services should manage credentials, user mapping, and delegation permissions. Support for passing user information does not prove end-user authorization is complete.

“Analyze only East China” expresses business scope; “the current identity can access only East China data” expresses authorization. Establish both separately.

Validate data permissions under actual access modes. HENGSHI applications support different data access and authorization configurations; do not assume every interface automatically adds the same row and column rules. For example, derived datasets should not be assumed to inherit every source dataset’s row permissions. Before launch, validate visible results for actual users, datasets, and calling methods.

4. SQL and HQL are execution tools; consistent definitions are central to governance

Programmatic integration does not require excluding SQL or HQL. HENGSHI CLI supports HQL / HE queries and data previews, and metrics encode calculations in expressions. Governance should address whether an external process bypasses approved models and metrics and creates another temporary definition.

For example, an external agent answering “this month’s cash revenue” might sum order totals. A successful query would still fail to reuse the enterprise’s cash-receipts definition. Prefer locating confirmed metrics and datasets. If a new calculation is necessary, validate expressions, granularity, time conditions, and sample results before deciding whether to make it reusable.

External processes can retain business questions, resource references, time ranges, effective filters, execution identities, and result states for later dashboard creation or business review. These are context conventions in an integration design, not evidence that all HENGSHI interfaces accept one universal request structure.

5. Hypothetical design: from business questions to follow-up actions

A hypothetical retailer wants weekly business analysis in an existing agent workflow. The following design illustrates responsibilities when connecting Dify, Coze, or a custom orchestration layer. Configure connectors and parameters for the actual products and deployed versions.

  1. Collect the question and confirm scope. A user asks to examine last week’s East China revenue change and identify stores requiring attention. The external process confirms the reporting period, resolves trusted identity, and locates available HENGSHI applications and datasets.
  2. Hand analysis to HENGSHI. Use the appropriate analytics entry point, reuse the confirmed revenue metric, compare periods, and analyze by store. Return requests for missing information when refund data is absent, time meaning is unclear, or access is unauthorized.
  3. Create reviewable deliverables. Use dashboard authoring or resource operations as needed and retain metric definitions, time ranges, and chart configuration. A temporary answer can instead deliver query results and explanation; not every request needs a new dashboard.
  4. Choose native distribution or external orchestration. Use HENGSHI subscriptions for recurring dashboard pushes. Let the external process coordinate systems when approval, tickets, or responsibility assignment is needed first. Confirm recipients and the data scope of generated content before sending.
  5. Verify completion. Read target objects again or open their pages to confirm dashboards were saved with the expected data and filters. Then check subscription records or external receipts. Business users confirm explanations and follow-up actions.

HENGSHI subscriptions support email, WeCom, Feishu, DingTalk, Webhook, and other methods, including schedules and delivery records. They require corresponding service or channel configuration. Verify recipient identity, content-generation identity, and pushed data scope against actual settings.

6. Deliver reliably by recognizing actual execution states

Read queries, authoring, authorization, and message distribution have different consequences and should not share one retry policy. Enterprises can adopt the following handling patterns, implementing error recognition and state queries according to the actual interfaces.

SituationSuggested process response
Ambiguous question or missing definitionClarify or build the definition before repeating an incomplete request
Invalid authentication or insufficient permissionsStop identity-dependent calls and check authorization and configuration
Query timeout or temporary network failureUse bounded retries while retaining time and filter conditions
Write timeout with an unknown outcomeRead the target object first to avoid duplicate creation
A plan was generated or dry-run passedDistinguish rehearsal from execution; do not mark the result saved
Query succeeded but distribution failedRetain the analysis and handle distribution separately, confirming receipt

HENGSHI CLI provides dry-run for supported operations to inspect plans and rehearse changes. It does not replace execution and result readback. External orchestration can retain its task identifiers and key call states alongside HENGSHI audit logs and delivery records to connect the cross-system process.

HENGSHI makes existing enterprise models, metrics, analysis, and dashboards available for agents and business systems to reuse. External platforms organize business workflows, while HENGSHI supplies analytical execution and delivery with defined semantics and permission boundaries. Explicit context and actual states connect the two, turning individual calls into maintainable enterprise analytics processes.

HENGSHI SENSE

Resources, ecosystem, and implementation stories

Explore how teams design and ship analytics with HENGSHI.

Request a trial

Enterprise deployment, embedded delivery, and trial requests can all be handled quickly.