There's a tension in agent design: should you prune failures from the message history? Pruning prevents a "poisoned" context where hallucinations persist, but keeping failures allows the agent to see the error and correct its approach. For tool call errors, the speaker prefers keeping them in.

Related Insights

AI interactions often involve multiple steps (e.g., user prompt, tool calls, retrieval). When an error occurs, the entire chain can fail. The most efficient debugging heuristic is to analyze the sequence and stop at the very first mistake. Focusing on this "most upstream problem" addresses the root cause, as downstream failures are merely symptoms.

AI errors, or "hallucinations," are analogous to a child's endearing mistakes, like saying "direction" instead of "construction." This reframes flaws not as failures but as a temporary, creative part of a model's development that will disappear as the technology matures.

The effectiveness of agentic AI in complex domains like IT Ops hinges on "context engineering." This involves strategically selecting the right data (logs, metrics) to feed the LLM, preventing garbage-in-garbage-out, reducing costs, and avoiding hallucinations for precise, reliable answers.

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.

AI's occasional errors ('hallucinations') should be understood as a characteristic of a new, creative type of computer, not a simple flaw. Users must work with it as they would a talented but fallible human: leveraging its creativity while tolerating its occasional incorrectness and using its capacity for self-critique.

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.

When an agent fails, treat it like an intern. Scrutinize its log of actions to find the specific step where it went wrong (e.g., used the wrong link), then provide a targeted correction. This is far more effective than giving a generic, frustrated re-prompt.

When an AI model makes the same undesirable output two or three times, treat it as a signal. Create a custom rule or prompt instruction that explicitly codifies the desired behavior. This trains the AI to avoid that specific mistake in the future, improving consistency over time.

An OpenAI paper argues hallucinations stem from training systems that reward models for guessing answers. A model saying "I don't know" gets zero points, while a lucky guess gets points. The proposed fix is to penalize confident errors more harshly, effectively training for "humility" over bluffing.

The simple "tool calling in a loop" model for agents is deceptive. Without managing context, token-heavy tool calls quickly accumulate, leading to high costs ($1-2 per run), hitting context limits, and performance degradation known as "context rot."