Analyzing Data Files
Never jump straight to deep analysis. Always follow the escalation ladder:
- Overview → delegate to
dataFile-contextfor a lightweight scan. - Present + ask → summarize findings, ask "Would you like to explore any aspect of this file in more detail?" (plain conversation, not the
questiontool). - Check existing context first → if the answer is already known, answer immediately.
- Targeted retrieval → delegate to
dataFile-contextagain with a specific, narrow request. - Escalate → only if still insufficient, delegate to
excel-readerfor deep computation.
Never skip a level. Never repeat full analysis when a targeted query suffices.
Progress:
- Step 1: Get initial overview from
dataFile-context - Step 2: Present overview, ask if user wants more detail
- Step 3: Classify user's response (affirmative / negative / ambiguous)
- Step 4: Check if existing context already answers the question
- Step 5: If not, send targeted retrieval request to
dataFile-context - Step 6: If still insufficient, escalate to
excel-reader - Step 7: Answer user, flagging limitations and assumptions
Step 1 — Initial Overview
Delegate to dataFile-context. Request, when available:
- File structure, format, worksheets, dimensions
- Column names, data types, apparent purpose
- Key metrics, representative findings, notable patterns
- Data quality issues or structural limitations
- Formulas/relationships between worksheets
Use lightweight inspection and samples — no expensive computation at this stage.
Step 2 — Present and Ask
Summarize concisely. End with exactly this question in normal conversation text:
"Would you like to explore any aspect of this file in more detail?"
Do not use the question tool. Do not proceed until the user replies.
Step 3 — Classify the Response
- Affirmative (explicit yes, request for detail, or a specific follow-up question) → go to Step 4.
- Negative (explicit decline) → stop the workflow.
- Ambiguous/unrelated → don't start deeper analysis; ask for clarification only if truly needed, otherwise wait.
A specific question about the file counts as implicit authorization.
Step 4 — Check Existing Context
Before delegating again, check whether the overview (or prior findings in the conversation) already answers the question.
- Sufficient → answer now, label verified facts vs. assumptions, stop.
- Insufficient → go to Step 5.
Step 5 — Targeted Retrieval
Delegate to dataFile-context again with:
- The user's exact question/objective
- Findings already obtained
- The specific missing piece
- Relevant worksheets/columns/ranges if known
- Expected output format and accuracy needs
Request only what's missing — never redo the full initial scan.
Evaluate the result:
- Sufficient and verified → answer, stop.
- Incomplete/unreliable → go to Step 6.
- Access/processing failure → escalate only if
excel-readercan plausibly resolve it; otherwise explain the limitation to the user.
Step 6 — Escalate to excel-reader
Use only for tasks dataFile-context cannot reliably handle:
- Complex calculations, aggregations, statistics
- Cross-worksheet comparisons, joins, relationship analysis
- Detailed filtering/grouping/reconciliation
- Inspecting specific formulas, cell ranges, or records
- Large-scale data quality investigations
- Trend analysis requiring heavy processing
- Validating results context alone can't confirm
Include in the delegation: original question, existing context, what was already tried, and the unresolved requirement. Never ask the user to re-supply information already gathered.
Step 7 — Final Answer
After excel-reader (or earlier steps) return results: answer directly, note limitations, avoid unsupported conclusions. If nothing can resolve it, state clearly what couldn't be verified and what's missing.
Example 1:
Input: User uploads sales_2024.xlsx, no question asked.
Output: Agent runs Step 1 overview ("3 sheets: Summary, Transactions, Returns; Transactions has 12,400 rows with columns Date, SKU, Qty, Revenue..."), presents it, asks the standard follow-up question, then waits.
Example 2:
Input: User replies "Yes, what were the top 5 products by revenue in Q3?"
Output: Agent checks existing overview — insufficient (no aggregation done). Sends targeted request to dataFile-context: "Compute top 5 SKUs by summed Revenue where Date is in Q3, using Transactions sheet." Returns answer with numbers.
Example 3:
Input: Follow-up: "Now reconcile Returns against Transactions to find mismatched order IDs."
Output: This requires cross-sheet join/reconciliation — escalate directly to excel-reader with full context (original question, overview, Q3 findings, and the new requirement).
Example 4: Input: User replies "no thanks." Output: Stop. No further analysis. Acknowledge and end.
- Always try the cheapest sufficient method first; never default to
excel-reader. - Carry forward prior findings in every delegation — don't make agents re-derive known facts.
- Keep the Step 2 question verbatim and in plain conversation.
- Distinguish verified data from inference in every answer.
- Treat a specific follow-up question as implicit consent to proceed.
- Using the
questiontool instead of plain conversational text in Step 2. - Escalating to
excel-readerbefore attempting a targeteddataFile-contextretrieval. - Re-running the full initial overview instead of a narrow targeted query.
- Proceeding with analysis on an ambiguous or unrelated user reply.
- Asking the user to repeat information already captured in context.