← Back to Technical blog

Technical article

How Much Context Does One Question Need? Context Budgeting and Trimming in HENGSHI Data Agent

Prepare metric definitions, time fields, permissions, and conversation criteria so Data Agent can find the information it needs.

Nov 30, 2026Technical blogHENGSHI8 min read
Data AgentChatBI

Article body

Full article

To answer a question about East China sales volume last month, Data Agent needs the business definition of sales volume, a date field, the region’s organizations, and the current user’s access. Too little context can turn order line counts into order counts. Excess fields, repeated history, and long examples can make the necessary information harder to find. HENGSHI SENSE 7.0 offers query scope, dataset knowledge, runtime skills, and model configuration to improve how information reaches the model.

Keep important semantics where teams can maintain them

MaterialWhat the question needsHow to prepare it
Application, data package, or subject areaOperations, sales, marketing, or finance scopeChoose a scope and name resources by purpose.
Fields and entitiesRepeating order IDs and region encodingAdd field documentation, types, relationships, and dimension definitions.
Metrics and termsCalculations for sales and order valueMaintain formulas, time axes, default filters, and synonyms.
Industry rules and toolsReusable units, rules, and stepsDocument them in runtime skills.
Confirmed conversation criteriaChannels, dates, and user additionsVerify inheritance in follow-ups and start a new conversation for a new scope.

An order detail table can have several rows per order. Document average order value as total payments received divided by distinct orders and state how to handle refunds, cancellations, and valid orders. Use anonymized representative enumeration values and explain unknown statuses. Dataset knowledge holds business semantics. Runtime skills hold reusable rules and tool guidance. Existing platform permissions still govern access.

Duplicate names such as “Sales Analysis” and generic “amount” descriptions make it hard to distinguish store net receipts from tax-inclusive e-commerce order amounts. Specify whether in-store scan-payment refunds are deducted and e-commerce platform discounts are included. Trigger both candidates with the same keyword to see whether names, fields, or calculations need work.

Leave room for material that can change the answer

Start a standard query with a definition, time field, and authorized scope. Add the dimensions and relationships relevant to the question. For complex work, use a package or subject area and check stores, categories, and channels in steps. Trim repeated history, expired assumptions, and irrelevant fields from templates while retaining definitions, absolute dates, and unresolved criteria. Measure effects on real questions and response times.

Example business semantics
Package    Order operations analysis
Metric     Average order value = total payments received ÷ distinct orders
Time       Payment time, calendar months in the tenant time zone
Filter     Valid paid orders only. Process refunds under the Finance rule.
Check      An order containing several products still counts as one order.

Use the record in dataset descriptions or acceptance questions. Update metric definitions and knowledge when business rules change, then rerun the same sample. Compare token count and latency with incorrect selections, repeated clarification, and correct results.

Check conversation state and model configuration separately

A selected scope stays fixed for the conversation. When no scope was preset, later turns reuse the confirmed scope. Start a new conversation when changing from an orders package to Finance or from Ask to Act. To remove a temporary region filter, request it explicitly and verify the result.

HENGSHI 7.0 records a model configuration identifier and an audit revision for a new conversation. Later turns read the effective configuration by identifier. Changes to timeout, model, or reasoning effort take effect on the next turn. The current turn keeps its starting configuration. When comparing models, hold data, account, question, and scope constant.

Under a capacity constraint, compare paired versions of “What was October 2026 average order value in East China stores?” In one pair change only field documentation. In the other change only the query scope. Record package, accuracy against the baseline, clarification, and latency to separate metadata effects from scope effects.

Isolate the material that improves answers

An order header has one row per order and item detail can have several. With two orders and three item lines totaling CNY 600, the average is CNY 300 per order or CNY 200 per item line. Add a typical store and a refunded order. Observe chosen metrics, datasets, and grain and reconcile row counts, amounts, and denominators separately.

ComparisonChange onlyWhat to compare
Original wording and a synonym“Average payment per order” in place of “average order value.”Same business metric and data scope.
Existing description and explicit grainSpecify that item detail can repeat order IDs.Whether the first usable answer uses distinct orders.
Detailed rules and concise summaryKeep date, refund, and grain while removing repeated examples.Accuracy, sources, and latency.
One question and follow-upsAdd category or month to the same definition.Retained conditions and reconciliation after grouping.

Hold account, data snapshot, scope, and model version constant. Record data, clarification, model, and tokens. Check slow cases for extra queries or data source waits using the trace. When more tokens leave answers wrong, examine formulas, field descriptions, and aggregation.

Assign an owner to every kind of context

The data team should maintain East China’s organization mappings. HENGSHI runtime skills can carry reusable units, analytical steps, and tool guidance. Restate temporary channel, date, and presentation preferences in a follow-up and verify them on the result. After data changes, update definitions and retest old questions. After changes to a skill, test several applicable packages for irrelevant constraints. Record tests with their owners.

Use failures to find missing context

SymptomCheck firstRetest
Incorrect data packageNames, scope, termsCompare a scoped question with one that prompts clarification.
Chart uses the wrong metricFormula, denominator, defaults, relationshipsTest multiple items, refunds, and empty results.
A follow-up carries old filtersTemporary versus confirmed criteriaModify criteria in the same conversation, then retry in a new one.
More context adds latencyRepetition, broad scope, data source delaysCompare tokens and latency on representative questions.
Unexpected differences across accountsRoles, data access, embedded identityTest roles with known data scope.

Prepare standard, ambiguous, cross-dimension, and long-conversation questions. Verify explanations of formulas, dates, and sources, then observe latency and repeated clarifications as context improves.

About HENGSHI

Founded in 2016, HENGSHI builds enterprise analytics for the Data+AI era. Its Agentic BI offerings bring together HENGSHI SENSE, HENGSHI digital employees, the HENGSHI CLI execution engine, and HENGSHI BOX for private deployment. With ten years of BI experience, HENGSHI supports software vendors through Powered by Hengshi and provides integrated AI analytics for manufacturing, finance, retail, and government.

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.