In the world of generative artificial intelligence, waiting is a reality. Whether for image generation (15-45 seconds), video generation (2-5 minutes), or audio processing (30-90 seconds), AI operations take time. Yet today's users expect instant responsiveness from web applications.
This gap creates a form of uncertainty: the user doesn't know whether the system is working or has encountered a problem, which can ultimately generate frustration. Is your system working, or has it crashed? Should you wait, or restart everything? This uncertainty, far more than the wait duration itself, is one of the main causes of abandonment, even when the request is actually being processed.
It is precisely to address this fundamental issue that we developed the "Loading Graph": a clear, structured mechanism that communicates not only that something is happening, but specifically what, where the process stands, and how it's progressing. A direct response to the silent waiting that erodes trust.
The "Loading Graph": An Architecture Designed for Experience
The "Loading Graph" goes far beyond the function of a simple progress bar. It's a system designed to concretely improve the user experience by replacing static indicators with contextual, evolving feedback.
Architectural Philosophy: Why a Dedicated Entity?
The decision to create a dedicated loading graph rests on solid architectural principles:
Separation of Concerns: Loading messages belong to the user interface (UI/UX), not to business logic. By isolating this functionality, we maintain a clean separation between operational logic and user feedback systems.
Reusability: A single "Loading Graph" can serve multiple tools and operations without duplicating message generation logic.
Contextual Intelligence: Rather than a bland "Loading...", each node provides a precise message, adapted to the current operation (e.g., image generation, audio processing...).
Non-Intrusive Integration: The "Loading Graph" runs in parallel with the main pipeline, without interfering with business logic or compromising process stability.
Event-Driven Integration with LangGraph: The Role of on_tool_start
Our "Loading Graph" integration relies on LangGraph's event system, specifically the on_tool_start event. It's a perfect hook for activating loading messages:
Ideal Timing: on_tool_start fires at the exact beginning of a tool's execution, providing the perfect moment to initiate contextual loading messages.
Tool Identification: The event contains the tool name, allowing the system to select the appropriate message for the specific operation.
Clean Lifecycle Management: This event-driven approach creates a natural start/stop cycle for loading messages, without requiring manual coordination between systems.
The boolean state tool_executing is crucial and acts as a logical lock to prevent execution conflicts and cleanly stop contextual messages once the operation is complete.
Our UX research led to adopting a three-message pattern per operation, for an optimal balance:
Initial Acknowledgment: Confirms that the request has been understood and processing has begun.
Progress Indication: Provides a sense of advancement, reducing doubt.
Completion Preparation: Signals that the operation is nearing its end, preparing the user for the result.
More than three messages would be overwhelming; fewer than three would provide insufficient feedback for long operations. Each tool category has its own specialized messaging, reflecting the actual technical steps and user expectations.
The "Loading Graph" integrates by monitoring events via LangGraph's astream_events(), intercepting events without disrupting the main flow. Loading messages are generated asynchronously, in parallel with tool execution, ensuring real-time feedback without blocking operations. A 2-second delay between messages, tested on tools taking 6 to 8 seconds, proved optimal, but it's crucial to adapt this timing to your actual operation durations.
Robustness and Simplified Maintenance
The system incorporates graceful degradation logic: if a tool has no specific configuration for loading messages, a fallback with default messages is automatically activated. This ensures the user experience remains consistent, even with partial integration.
Configuration is done declaratively via a centralized mapping, making it straightforward to add new tools without modifying the core code. This approach promotes reusability, limits side effects, and simplifies maintenance by reducing the cognitive load associated with system evolution.
Tangible Benefits
Integrating the Loading Graph delivers tangible advantages, both on the user side and the technical side:
Enhanced User Experience: by reducing doubt, creating a perception of fluidity, and giving the application a more professional, polished feel.
Increased Technical Visibility: the graph enables execution monitoring, facilitates debugging by exposing internal steps, and lays the groundwork for a future profiling or optimization system.
A gain in clarity for the user, a gain in control for developers.
In conclusion, the Loading Graph embodies a structured approach to improving user experience in AI systems. By leveraging LangGraph's event system and rigorous state management, it delivers relevant feedback without compromising performance or architectural integrity.
The design emphasizes maintainability, scalability, and functional consistency, while preserving the robustness required for production environments. This project demonstrates that UX optimizations can be harmoniously integrated into complex architectures while maintaining the rigor needed for proper operation.
Développeuse Lamalo (scale-up by Reboot), formée à Fabéon Campus à Strasbourg, Sandrine se distingue par sa rigueur et sa capacité à trouver des solutions innovantes aux défis techniques. Reconnue par ses pairs pour son esprit d'équipe et sa persévérance, elle apporte un vrai savoir-faire aux projets de développement.
LinkedInGet our best articles every month.
Père Castor, raconte-moi N8N N8N (prononcez « n-huit-n » ou « nodemation » si vous voulez faire classe). C'est un outil qui permet de connecter vos...
ArticleL'intelligence artificielle s'est invitée dans le quotidien des marketeurs à une vitesse record. En quelques mois, des outils comme ChatGPT,...
ArticleLe risque ? Créer une \"illusion de compétence\" tout en laissant les véritables lacunes stratégiques se creuser. La solution est pourtant simple et...
ArticleÀ lire avec la voix de Stallone : « plus de puces, plus de data, plus de milliards, le maître du monde ». Je viens de regarder le dernier numéro du...
ArticleSoyons clairs : si vous dirigez une organisation de taille significative aujourd'hui, la complexité des données—leur volume, leur vitesse de...
ArticleOn parle ici d'une transformation fondamentale, un changement de paradigme comparable à l'arrivée d'Internet ou de l'électricité dans l'industrie....