Function node is used to call a function, whether it’s a pre-built function or a custom function. It’s not intended for having a conversation with the user, but agent can still talk while in this node if needed.

The function that associates with this node will be called when entering this node.

Add a Function

Here you need to add the function first, and then select it inside the node. This way if you delete the node, you don’t need to re-create the function again.

For specific instructions on different types of functions:

When Can Transition Happen

  • if wait for result is turned off
    • if speak during execution is turned on, the agent will transition once done talking
    • if speak during execution is turned off, the agent will transition immediately after function gets invoked, which is right upon entering the node
    • if the user interrupts the agent, the transition can also happen once user is done speaking
  • if wait for result is turned on
    • if speak during execution is turned on, the agent will transition once function result is ready and agent is done talking
    • if speak during execution is turned off, the agent will transition once function result is ready
    • if the user interrupts the agent, the transition can also happen once function result is ready and user is done speaking

Given that the function node takes function result into consideration for transition timing, you can write your transition condition to be based on the function result.

Node Settings

  • Speak During Execution: when enabled, a text input box will show up where you can write instructions for the agent to follow to generate an utterance like Let me check that for you. to say while the function is being executed. You can choose between Prompt and Static Sentence.
  • Wait for Result: when enabled, the agent will wait for the function to finish executing before attempting to transition to any other node. This guarantees that when you reach the next node, the result is already ready to be used.
  • Global Node: read more at Global Node
  • Block Interruptions: when enabled, the agent will not be interrupted by user when speaking.
  • LLM: choose a different model for this particular node. Will be used for function argument generation, and potentially speak during execution message generation.
  • Fine-tuning Examples: Can finetune transition. Read more at Finetune Examples

How to Tell User the Result

Since the function node is not intended for having a conversation with the user, you will need to attach a conversation node to the function node to tell the user the result. You can create different conversation nodes for different function results, so that it can engage user in different ways when function result varies.