← Back to Technical blog

Technical article

From Describing a Query to Driving a Task: The Boundary of Task-Oriented Query Languages

Use a regional daily report to explain the boundary between query, permissions, orchestration, and recoverable delivery.

Nov 26, 2026Technical blogHENGSHI9 min read
HQLWorkflowAgentic BI

Article body

Full article

“Generate an East China sales report every day and tell the owner if refunds are incomplete” involves querying, validation, generating an output, and handing work over. SQL or HQL can express scope and metrics, and a database optimizer can plan each query. The task layer must also decide if today’s run can start, where to resume after failure, and how a draft gets published. Those responsibilities determine whether a change belongs in a query, workflow, or business permission.

1 How queries, semantics, and tasks divide the work

LayerResponsibilityDaily report example
Query and metric expressionsFiltering, joining, aggregation, and metric logicCompute settled net sales by store
Semantics and permissionsAvailable datasets, fields, metrics, and role scopeA regional account sees only East China. Refund attribution follows Finance rules
OrchestrationPreconditions, order, checkpoints, retries, and deliveryWait for refunds, verify data, draft the report, and hand it off for review
Business systemsAuthorization, publication, and delivery confirmationThe host stores outputs and receipts and decides whether to redeliver

Query languages and task descriptions can both be declarative. The query engine chooses an execution method based on data and optimization capabilities. Orchestration specifies dependencies among steps and handles cross-system failures. Database optimization, scheduler retries, and business approval each have different inputs and evidence.

2 Turn the business goal into an executable contract

At minimum, the daily task needs a business date, organizational scope, authoritative metric, data readiness criteria, supported execution identity, and deliverable. The result should identify the input batch and exceptions. This example describes an integration configuration. The actual orchestrator owns fields and states.

task: regional_daily_sales
scope: east_china
metric: net_sales
required_inputs:
  - settled_orders_snapshot
  - refunds_snapshot
start_when: both_snapshots_cover_business_date
deliverable: reviewable_report_draft
publish_after: business_owner_approval
on_missing_input: wait_and_record_missing_snapshot

For routine work with a clear scope, fix the metric and report structure to reduce repeated inference. For open-ended multistep analysis, an Agent can choose data and analysis steps within its approved tools. Check version support, data access, and action authorization for publication, write-back, and dashboard changes.

Use metadata to know where to look for evidence

Before running, the catalog can identify metrics, datasets, dependencies, and access. For registered data, check the source business date, ingestion time, and close status. A successful source job can still contain only some stores. Check region, partitions, and the Finance close condition. If data is missing, record the specific business date and owner and hold formal distribution of the incomplete snapshot.

Resource decisions also need observable evidence. A summary can use an aggregated dataset with the same definition. Verify that recovery works under the same access and scope, and record data read, queue time, and whether results reconcile. The platform can use these signals to optimize a query or task plan. The responsible components still perform recalculation and data readiness checks.

3 Make the execution graph and state resumable

Represent the task as a directed acyclic graph. Verify that data is ready before querying and reconcile before drafting. Business review is a separate later node. Log each step’s dependencies, output version, error type, and owner. Checkpoint reuse depends on unchanged inputs, valid access, and persisted outputs. Orchestration can retain valid checkpoints and recompute from the same inputs when necessary.

Check order and refund snapshots → Query the approved net sales metric → Reconcile with the baseline
                                                                           ↓
                                                      Draft report → Human review → Submit for publication

If the report exists but the host’s publish API times out, look up the output by business key before retrying, recording it, or handing it off. A key can include report type, region, business date, and data version. Recalculation after late data creates a distinguishable version. Retain publication state and guidance for the previous output. If permissions changed after a failure, verify subsequent steps against the current execution identity.

4 Use supported HENGSHI entry points

HENGSHI’s analytics stack illustrates the division. HENGSHI SENSE provides data assets, HQL metrics, and analytics applications. Data Agent supports designated-source questions, Agent, and Workflow entry points. HENGSHI CLI exposes supported BI operations to terminals and external agents. HENGSHI JARVIS practices cover organizational knowledge, sources, and human handoff. When connecting these entry points into production, the enterprise’s workflow system or orchestrator manages cross-system state and approvals.

For a fixed analytics model, compare metrics and dashboards in HENGSHI SENSE. The public CLI documentation covers model queries, data preparation, dashboards, and runtime commands. Check installed help for parameters, permissions, dry-run support, and output formats.

hbi data-model query --help
hbi scheduler --help

For open-ended questions, try Data Agent within authorized search and analysis. For fixed questions against a designated data source, evaluate Workflow. A host can integrate analysis through the documented API and own upstream snapshot checks, scheduling, external publication, and receipts. Verify UI, API, and modes separately. Identify authoritative sources for catalog, quality, and retry policies.

Keep a separate record for the continuing objective and each run

For “deliver an East China report every day,” retain the owner, deadline, and current rules. An individual run records its version, inputs, metrics, identity, output, and errors. If late data prompts a recalculation at noon, record a separate run for the same business date and track which version was approved. This links business state even when generation and delivery are in different systems.

Before retrying an external write, look for evidence it completed. When a metric read creates no external state, recalculating from the same snapshot under the same permissions usually verifies the result. After a create or send call, check the business key and destination record and identify the system responsible for avoiding duplicates. Approvals, external delivery, and production state changes follow granted permissions.

5 Verify failure paths as part of delivery

ScenarioExpected behaviorEvidence
Late refund snapshotRecord the missing input and wait, with the report status visibleSnapshot coverage, wait reason, and next run record
Conflicting metric aliasesUse the confirmed definition or escalate for clarificationMetric, filters, permissions, and final version
Generation stops midwayPreserve verifiable inputs or outputs and resume according to policyPersisted checkpoints, data used, and recovery steps
Publication times outLook up the existing output by business key before resubmissionBusiness key, host receipt, and human handoff

Verify a normal report, then exercise late data, node failure, and repeated runs. Dashboards and metrics provide verifiable calculations. The task layer records dependencies and output state. This boundary helps enterprises reuse analytics assets and route failures to the right owner.

About HENGSHI

Founded in 2016, HENGSHI develops Agentic BI for the Data + AI era. Its enterprise analytics platform, HENGSHI SENSE, works with the HENGSHI JARVIS digital employee, the HENGSHI CLI execution engine, and the privately deployable HENGSHI BOX. With a decade in BI and a Powered by Hengshi partner ecosystem, HENGSHI supports software vendors across industries and provides private, trusted AI analytics for business operations and decision-making in manufacturing, finance, retail, public services, and other enterprise settings.

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.