How srm-repo/sample-why-agents-fail works
This repository is a collection of executable learning demos for preventing AI-agent hallucinations and wasted tokens, rather than one integrated application. The principal workflow is a user query entering a demo agent, which applies a targeted retrieval, tool-selection, validation, context-management, timeout, or loop-control technique before producing a response or report. The graph preserves the README’s major demo branches; several relationships are documented at demo level, while unsampled implementation details are not inferred.
Main entry points: travel_agent_demo.py FAQ travel agent · token_comparison_app.py Tool selection comparison · chat_guarded.py Guarded loop chat · chat_pointer.py Memory pointer chat
Components 24
Hallucination Controls
- FAQ travel agent
stop-ai-agent-hallucinations/01-faq-graphrag-demo/travel_agent_demo.py - FAQ knowledge graph
stop-ai-agent-hallucinations/01-faq-graphrag-demo/build_graph.py - FAQ vector retrieval
stop-ai-agent-hallucinations/01-faq-graphrag-demo/load_vector_data.py - Tool selection comparison
stop-ai-agent-hallucinations/02-semantic-tools-demo/token_comparison_app.py - Semantic tool registry
stop-ai-agent-hallucinations/02-semantic-tools-demo/registry.py - Travel tool catalog
stop-ai-agent-hallucinations/02-semantic-tools-demo/enhanced_tools.py - Booking validation tools
stop-ai-agent-hallucinations/03-multiagent-demo/tools.py - Symbolic business rules
stop-ai-agent-hallucinations/04-neurosymbolic-demo/rules.py - Agent controls
stop-ai-agent-hallucinations/05-agent-control-demo/setup_controls.py
Context Management
- Conversation managers
stop-ai-agents-wasting-tokens/00-conversation-management-demo/chat.py - Memory pointer chat
stop-ai-agents-wasting-tokens/01-context-overflow-demo/chat_pointer.py - Pointer analysis tools
stop-ai-agents-wasting-tokens/01-context-overflow-demo/tools.py - Log analysis swarm
stop-ai-agents-wasting-tokens/01-context-overflow-demo/swarm_demo.py - Shared-state tools
stop-ai-agents-wasting-tokens/01-context-overflow-demo/tools.py
MCP Timeouts
- Async timeout chat
stop-ai-agents-wasting-tokens/02-mcp-timeout-demo/chat_async.py - Sync timeout chat
stop-ai-agents-wasting-tokens/02-mcp-timeout-demo/chat_sync.py - MCP demo server
stop-ai-agents-wasting-tokens/02-mcp-timeout-demo/mcp_server.py
Reasoning Loops
- Unprotected loop chat
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_loop.py - Guarded loop chat
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_guarded.py - Travel retry tools
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/tools.py - Tool call limits
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/hooks.py
Production Examples
- Production booking agent
stop-ai-agent-hallucinations/06-agentcore-production-demo/agent_files/booking_agent.py
Other components
- Demo user
- LLM provider
Connections 31
- Demo user → FAQ travel agent: asks FAQ
README.md - FAQ travel agent → FAQ knowledge graph: uses Graph-RAG
README.md - FAQ travel agent → FAQ vector retrieval: compares RAG
README.md - FAQ travel agent → LLM provider: reasons with
README.md - Demo user → Tool selection comparison: asks travel query
README.md - Tool selection comparison → Semantic tool registry: selects tools
stop-ai-agent-hallucinations/02-semantic-tools-demo/token_comparison_app.py - Tool selection comparison → Travel tool catalog: loads tools
stop-ai-agent-hallucinations/02-semantic-tools-demo/token_comparison_app.py - Semantic tool registry → Travel tool catalog: indexes tools
stop-ai-agent-hallucinations/02-semantic-tools-demo/token_comparison_app.py - Tool selection comparison → LLM provider: runs queries
stop-ai-agent-hallucinations/02-semantic-tools-demo/token_comparison_app.py - Demo user → Booking validation tools: requests booking
README.md - Demo user → Symbolic business rules: tests rules
README.md - Demo user → Agent controls: explores controls
README.md - Demo user → Conversation managers: asks recall question
README.md - Demo user → Memory pointer chat: asks log question
stop-ai-agents-wasting-tokens/01-context-overflow-demo/chat_pointer.py - Memory pointer chat → Pointer analysis tools: registers tools
stop-ai-agents-wasting-tokens/01-context-overflow-demo/chat_pointer.py - Memory pointer chat → LLM provider: runs agent
stop-ai-agents-wasting-tokens/01-context-overflow-demo/chat_pointer.py - Demo user → Log analysis swarm: requests report
README.md - Log analysis swarm → Shared-state tools: uses tools
stop-ai-agents-wasting-tokens/01-context-overflow-demo/swarm_demo.py - Log analysis swarm → LLM provider: runs agents
stop-ai-agents-wasting-tokens/01-context-overflow-demo/swarm_demo.py - Demo user → Async timeout chat: asks async agent
README.md - Demo user → Sync timeout chat: asks sync agent
README.md - Async timeout chat → MCP demo server: uses MCP
- Sync timeout chat → MCP demo server: uses MCP
- Demo user → Unprotected loop chat: asks travel query
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_loop.py - Unprotected loop chat → Travel retry tools: calls tools
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_loop.py - Unprotected loop chat → LLM provider: runs agent
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_loop.py - Demo user → Guarded loop chat: asks travel query
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_guarded.py - Guarded loop chat → Travel retry tools: calls tools
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_guarded.py - Guarded loop chat → Tool call limits: attaches limits
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_guarded.py - Guarded loop chat → LLM provider: runs agent
stop-ai-agents-wasting-tokens/03-reasoning-loops-demo/chat_guarded.py - Demo user → Production booking agent: explores deployment
README.md