Hyperflow Best Practices

Learn the best practices for creating and maintaining your Hyperflows

Hyperflow Implementation

  1. Use structured and standardized approaches

Implement Hyperflows using standardized patterns when possible to maintain consistency across your organization. This helps with maintainability and knowledge sharing. For example,

  • Create Hyperflows for a specific use case that works across multiple external systems (eg. ordering device during IT onboarding that requires completing tasks across ServiceNow and the Procurement Systems) or for a specific integration that addresses multiple use cases (eg. ticket management in ServiceNow)

  • When writing Hyperflow prompts, in additional to instructions for what Hyperflow should do, provide instructions for what it should not do and how it should handle exceptional scenarios.

  1. Implement proper error handling

Design your Hyperflows with robust error handling mechanisms.

  • Consider how the workflow should respond to various failure scenarios, similar to how transient failures are handled in distributed environments with automatic retry mechanisms.

  • Plan for scenarios where API or Action executions fail.

  • Test thoroughly before deployment.

  1. Break into Manageable Steps

For complex processes, break your Hyperflows into smaller, manageable steps that can be independently tested and verified. This approach resembles the WorkChain process class in other workflow systems, where units of work are specified as steps with logical outlines.

  1. Plan for Data Handling and Privacy

Carefully consider what data your Hyperflow will handle and ensure proper privacy measures are in place. Follow guidelines from the Generative AI and Open Data best practices to maintain transparency and appropriate data handling.

  1. When does the Hyperflow execution end, or how can the user end it?

  • The end of execution of a Hyperflow is determined by the underlying LLM / AI model - when the AI model decides that a user’s request has been fulfilled, or is unable to be fulfilled (for example, a request that is out of scope), it will end execution. After that, you will see the Feedback buttons on the Conversation interface.

  • Additionally, phrases like “That’s all my ask” or “Thank you!” can also end execution.

  • When a Hyperflow is finished, to trigger it again, your application needs to detect another Intent that triggers this Hyperflow.

Design for User Interaction

  1. How do Hyperflows interact with the user?

    1. Channels integrated with the application that execute the Hyperflows. This is consistent across all types of flows and fulfillments.

    2. Email, SMS, etc., using the Notification Action that, for better security, needs to be explicitly added to the Hyperflow by the flow builder.

  2. Are Hyperflows output formatted?

    1. By default, Hyperflows produce markdown-formatted output. The formatting can be changed in one of two ways:

      1. Prompt instructions

      2. For highly bespoke and complex requirements, you can create display functions with user interaction nodes in workflows. Examples include:

        1. Customized data display cards

        2. Charts

    2. Prevent overloading a Hyperflow with any task (eg. formatting instructions) that can be easily achieved with a workflow.

  3. Balance Automation with Human Oversight

While Hyperflows can operate autonomously, determine appropriate points for human oversight and intervention, especially for critical decisions or complex scenarios. These can be provided using Hyperflows instructions and User Interaction Nodes in Workflow used as Functions.

Maintenance

  1. Regularly Review and Update Your Hyperflows

Set a schedule to review your Hyperflows regularly, ensuring they remain aligned with business objectives and leverage the latest platform capabilities.

  1. Leverage Version Control

Keep track of changes to your Hyperflows using version control practices. Document each version with comprehensive context about changes made.

  1. Gather and Incorporate User Feedback

Since Hyperflow leverages feedback learning to improve its capabilities, establish mechanisms to collect and analyze user feedback about their interactions with your Hyperflows.

Optimization

  1. Reduce unnecessary steps

Optimize your Hyperflows by eliminating redundant steps and streamlining execution paths.

  1. Reduce perception of latency

LLMs are inherently slow to respond. This is compounded with RAG that requires search / retrieval, followed by LLM summarization.

Hyperflows and the RAG Action function support streaming of output without having to wait for the complete response to be generated. Leverage these to reduce the perception of latency.

  1. Optimize memory and context management

During a conversation session, Hyperflows always have context of the conversation history. Additionally, Hyperflows provide three levels of memory for you to use:

  • Context window: a per-request short-term memory which is limited by the context window of the underlying AI model. Currently, Hyperflows provide 100K+ token context window, which will continue to expand rapidly in the upcoming releases,

  • Session Variables: a per-session shared memory which can be used by all the flows that are triggered during a user session. Functions and Nodes are provided to easily read/write to this memory from Hyperflows and Workflows, respectively.

  • Custom tables: long-term memory that can be used across sessions. Functions and Nodes are provided to easily read/write to this memory from Hyperflows and Workflows, respectively.

Using appropriate memory is critical to ensuring accuracy and performance. For example,

  • Avoid returning too much content from a function call to the Hyperflow context window. Instead, use pagination (API calls), or post-process data using a Workflow before returning only the necessary information to the Hyperflow.

  • Instead of passing information between Hyperflows and functions, use session variable as shared memory.

Last updated