Hyperflow Implementation Example

Building a Hyperflow from scratch

Before adding instructions to the Hyperflow Prompt field you should first understand and clearly document the use case:

  • Identify the AI agent’s role. (What is it, who is it helping).

  • Define its main job (What’s the AI agent supposed to achieve).

  • Make a note of the tools needed (What functions can it call, and when).

Role clarity

Define who the AI agent is and its primary mission.

What to include:

  • The role/persona (IT Agent, Purchasing Assistant, HR Helper).

  • The main objective (troubleshoot tickets, retrieve purchase orders).

  • The speaking style (level of formality, conciseness).

Example: You are a purchasing assistant that retrieves and explains purchase orders. You should always reply in a very formal tone and be as comprehensive as possible in your answers.

Scope boundaries

Prevent the AI agent from wandering into unrelated topics.

What to include:

  • The topics or functions the AI should focus on.

  • A rule or logic to decline or handle unrelated requests.

Example: Only handle requests related to purchase orders. Politely decline unrelated topics.

Execution plan

Give the AI agent a clear sequence of steps, including when to act and when to ask for clarification.

What to include:

  • Numbered steps describing the action to take.

  • Conditions for running each step (missing data checks, ambiguity checks).

  • Keep each step short (max 10 words for the action required).

  • Do not add the descriptions and function input/output parameter information in the instructions. These should only be added in the function specs.

Example:

  1. Identify which of the above tasks the user is requesting.

  2. Gather any missing details needed (requisition ID, purchase order ID).

  3. Call the correct function to retrieve or list the requested information.

  4. Present the results clearly and concisely.

Fallback instructions

Tell the AI agent what to do if a tool call doesn’t work.

What to include:

  • Number of retries, whether the agent should ask the user for more details in specific use cases, or stop.

  • A short, polite error message.

  • A business logic for handling failures.

Example: If a tool call fails, say “I couldn’t retrieve the data. Please try again.” and stop.

Knowledge source priority

Avoid hallucinations by telling the AI agent where to get facts first.

What to include:

  • The source of truth (tool output, database).

  • How to respond if no data is found.

Example: Always use the purchase order tool as the first source. If there are no results, say “No data found” instead of guessing.

Guardrails

Prevent the AI agent from doing things it should never do as per your business logic.

What to include:

  • Critical stop conditions (stop if authentication fails).

Example: Never skip authentication. Never invent missing data.

Output formatting

Ensure the final output is consistently formatted.

What to include:

  • Formatting instructions for returning results in bullet points vs. full sentences.

  • Hyperflows support two formatting styles: Markdown and HTML.

Example: Reply in two parts: a one-sentence summary, then bullet-pointed actions.

Triggering a Hyperflow

  • In intentless apps: The builder needs to provide a meaningful description of what the Hyperflow is intended to do for it to be triggered.

  • In intent-based apps: A Hyperflow needs to be associated with one or more intents containing phrases that should trigger it.

Debugging a Hyperflow

While testing in AI Lens the debug information for a Hyperflow is accessible by selecting your request from the right side of the screen.

  • name → Hyperflow name.

  • modelInfo → Information of the LLM being used.

  • error → Displays an error message if one occurs during execution.

  • executedFunctions → Lists the executed functions and their details.

  • llmCalls → Shows all sequential LLM calls made to process a user’s request.

    • A request that completes successfully with the expected response must end with a call to the “finish_function” , and the status must be set to “fulfilled”.

Function specifications

  • Always include a function description along with input and output variables and their respective descriptions.

  • The description should be concise and clearly state what the function does.

  • The descriptions of individual functions should not overlap.

  • After publishing the function, always verify that the metadata (input/output variables, etc.) appears correctly in the Function Specs under the Hyperflow prompt.

Last updated