Stop AI Agent Hallucinations: 5 Techniques + Production Patterns - Elizabeth Fuentes, AWS

Elizabeth Fuentes from AWS presents five code-level techniques—semantic tool selection, GraphRAG with knowledge graphs, multi-agent validation, neuro-symbolic guardians, and runtime guardians—to reduce AI agent hallucinations by optimizing token usage, improving response accuracy, and enforcing rule-based constraints. These methods enhance AI reliability and scalability in production environments, demonstrated through frameworks like Strands and AWS services such as Amazon Bedrock Agent Core and Neo4j Aura DB.

In this session, Elizabeth Fuentes from AWS discusses five practical techniques to reduce AI agent hallucinations, focusing on code-level changes rather than prompt modifications. She emphasizes that every AI agent interaction incurs token costs for both input and output, and inefficient token usage can lead to hallucinations—incorrect or fabricated responses. The five techniques presented aim to optimize token usage, improve response accuracy, and catch errors before they reach users, thereby enhancing the reliability of AI agents.

The first technique, semantic tool selection, involves filtering which tools are included in the context for each AI call. Instead of sending all 29 tools of a travel agent into the model’s context, only the most relevant three tools are selected via semantic search using a vector store. This drastically reduces token usage from thousands to a few hundred per call and improves accuracy by limiting the model’s scope to pertinent tools. Elizabeth demonstrates this with code examples using the Strands agent framework and highlights how this approach scales better in conversational contexts by dynamically swapping tools.

Next, she introduces GraphRAG, an approach that replaces traditional text retrieval augmented generation (RAG) with graph-based queries for precise, aggregate, or multi-hop reasoning tasks. Using Neo4j as a knowledge graph database, the AI model generates Cypher queries to retrieve exact, computed answers rather than approximate samples from vector search. This method is particularly effective for questions involving counts or averages across datasets, where vector search often returns incomplete or misleading results. Elizabeth showcases how graph queries provide verifiable and accurate responses, improving trustworthiness.

The third technique is multi-agent validation, which addresses the problem of single agents rationalizing errors and returning false positive confirmations. By employing a swarm of agents—an executor, a validator, and a critic—each response is checked and approved or rejected before reaching the user. This layered validation prevents hallucinated confirmations and surfaces errors transparently. Elizabeth demonstrates this with the Strands swarm agent, showing how multi-agent workflows catch failures that single agents miss, thereby increasing reliability in critical applications like hotel booking.

Finally, Elizabeth covers neuro-symbolic guardians and runtime guardians, which enforce rules in code rather than relying on prompts. Neuro-symbolic guardians use hooks in the agent’s execution loop to block invalid tool calls based on hard-coded rules, ensuring constraints like maximum guest limits or payment verification are strictly enforced. Runtime guardians, implemented via the open-source Agent Control library, provide softer steering by allowing the agent to self-correct and complete tasks without hard stops, improving user experience. She concludes by highlighting how these techniques can be deployed in production using AWS services like Amazon Bedrock Agent Core, which offers scalable infrastructure, observability, and integration with tools like Neo4j Aura DB.