AI data agents can misinterpret results from large tables due to context window limits. The solution is twofold: instruct the AI to use query limits (e.g., `LIMIT 1000`), and crucially, remind it in subsequent prompts that the data it is analyzing is only a sample, not the complete dataset.

Related Insights

To avoid AI hallucinations, Square's AI tools translate merchant queries into deterministic actions. For example, a query about sales on rainy days prompts the AI to write and execute real SQL code against a data warehouse, ensuring grounded, accurate results.

Instead of building a single, monolithic AI agent that uses a vast, unstructured dataset, a more effective approach is to create multiple small, precise agents. Each agent is trained on a smaller, more controllable dataset specific to its task, which significantly reduces the risk of unpredictable interpretations and hallucinations.

When an AI model gives nonsensical responses after a long conversation, its context window is likely full. Instead of trying to correct it, reset the context. For prototypes, fork the design to start a new session. For chats, ask the AI to summarize the conversation, then start a new chat with that summary.

Even models with million-token context windows suffer from "context rot" when overloaded with information. Performance degrades as the model struggles to find the signal in the noise. Effective context engineering requires precision, packing the window with only the exact data needed.

Long, continuous AI chat threads degrade output quality as the context window fills up, making it harder for the model to recall early details. To maintain high-quality results, treat each discrete feature or task as a new chat, ensuring the agent has a clean, focused context for each job.

To safely empower non-technical users with self-service analytics, use AI 'Skills'. These are pre-defined, reusable instructions that act as guardrails. A skill can automatically enforce query limits, set timeouts, and manage token usage, preventing users from accidentally running costly or database-crashing queries.

Long-running AI agent conversations degrade in quality as the context window fills. The best engineers combat this with "intentional compaction": they direct the agent to summarize its progress into a clean markdown file, then start a fresh session using that summary as the new, clean input. This is like rebooting the agent's short-term memory.

A critical learning at LinkedIn was that pointing an AI at an entire company drive for context results in poor performance and hallucinations. The team had to manually curate "golden examples" and specific knowledge bases to train agents effectively, as the AI couldn't discern quality on its own.

To combat AI hallucinations and fabricated statistics, users must explicitly instruct the model in their prompt. The key is to request 'verified answers that are 100% not inferred and provide exact source,' as generative AI models infer information by default.

Hunt's team at Perscient found that AI "hallucinates" when given freedom. Success comes from "context engineering"—controlling all inputs, defining the analytical framework, and telling it how to think. You must treat AI like a constrained operating system, not a creative partner.