How To Build New Aurora Functions

How To Build New Aurora Functions

How To Build New Aurora Functions

This guide outlines the steps required to add a new function inside our app using Python. Follow these steps carefully to ensure proper integration with the system.

This guide outlines the steps required to add a new function inside our app using Python. Follow these steps carefully to ensure proper integration with the system.

Step 1: Create a New Function File

Navigate to app/functions and create a new Python file named after the function you are building. Ensure the file name follows the convention: function_name.py.

Navigate to app/functions and create a new Python file named after the function you are building. Ensure the file name follows the convention: function_name.py.

Example: If you are building a function to send a text message to a team, create a file called:

Example: If you are building a function to send a text message to a team, create a file called:

app/functions/send_text_to_team.py

Inside this file, define your function and include the necessary logic.

Inside this file, define your function and include the necessary logic.

Step 2: Organize and Integrate the function

  1. Create an appropiate module (if not already present)

    1. Example modules:

      1. app/functions/text_functions.py for text-related functions

      2. app/functions/jobber_functions.py for job-related functions

  2. Import your function in the module.

  3. Define a handler function.

    1. Add preprocessing and additional logic before calling your function.

    2. Include logging to track when the function is called

  1. Create an appropiate module (if not already present)

    1. Example modules:

      1. app/functions/text_functions.py for text-related functions

      2. app/functions/jobber_functions.py for job-related functions

  2. Import your function in the module.

  3. Define a handler function.

    1. Add preprocessing and additional logic before calling your function.

    2. Include logging to track when the function is called

from app.functions import(
# Other Functions
function_name as function_name_function
)

def function_name(data):
    """
    Description
    """
    logger.info("Called function_name")
    # Handle data before calling the function

    return function_name_function(data)
  1. Ensure functions include proper docstrings

    1. Every function should have a clear docstring explaining:

      1. Its purpose

      2. Expected parameters

      3. Return value

      4. Example usage

  1. Ensure functions include proper docstrings

    1. Every function should have a clear docstring explaining:

      1. Its purpose

      2. Expected parameters

      3. Return value

      4. Example usage

def function_name(data) -> str:
    """
    Briefly describe what this function does.

    Args:
        param1 (str): Description of the first parameter.
        param2 (int): Description of the second parameter.

    Returns:
        str: Explanation of the return value.

    Example:
        result = function_name(data)
        print(result)  # Expected output example
        
    """
    # Function implementation here...
  1. How the Assistant Uses This Function

    1. The assistant automatically extracts the required parameters from the function call and passes them as arguments. To ensure seamless execution, the function signature should match the expected input format.

    2. After the function is called:

      • If it executes successfully, the assistant will use the returned value to generate a response or take the next appropriate action.

      • If an error occurs or the function returns an unexpected value, the assistant will interpret the result and explain what went wrong.

  1. How the Assistant Uses This Function

    1. The assistant automatically extracts the required parameters from the function call and passes them as arguments. To ensure seamless execution, the function signature should match the expected input format.

    2. After the function is called:

      • If it executes successfully, the assistant will use the returned value to generate a response or take the next appropriate action.

      • If an error occurs or the function returns an unexpected value, the assistant will interpret the result and explain what went wrong.

Step 3: Add the Function to Calendar Agent

Modify app/swarm/calendar_agent.py to make the function accessible via the agent.

Modify app/swarm/calendar_agent.py to make the function accessible via the agent.

  1. Import your function from the module.

  2. Locate the build_agent_from_config function.

  3. Add your function to the function_map.

  1. Import your function from the module.

  2. Locate the build_agent_from_config function.

  3. Add your function to the function_map.

from app.functions.module import (
# Other Functions
function_name
)

def build_agent_from_config(assistant_config, user_phone,session_id):
...
function_map = {
    # Other functions...
    "function_name": function_name,
}
...

Step 4: Update the Database for Assistant Access

For the assistant to access this new function, update the assistantId_to_info database table.

For the assistant to access this new function, update the assistantId_to_info database table.

  1. Locate the assistant you want to associate with this function.

  2. Add the function name under the functions row.

  3. (Optional) Add function usage examples inside assistantPrompt

  1. Locate the assistant you want to associate with this function.

  2. Add the function name under the functions row.

  3. (Optional) Add function usage examples inside assistantPrompt

Step 5: Call and Test the New Function

Once all the above steps are complete, call your assistant and test the newly added function.

Once all the above steps are complete, call your assistant and test the newly added function.

  1. Ensure the assistant recognizes the new function.

  2. Verify that the function executes as expected.

  3. Check logs to confirm the function call is recorded properly.

  4. Debug any issues as needed.

  1. Ensure the assistant recognizes the new function.

  2. Verify that the function executes as expected.

  3. Check logs to confirm the function call is recorded properly.

  4. Debug any issues as needed.

Smarter Conversations Start Here

Smarter Conversations Start Here

Smarter Conversations Start Here

With VoxSuite, you can deliver better customer service while saving time and money. Let Aurora do the heavy lifting, so you can focus on what matters most.

With VoxSuite, you can deliver better customer service while saving time and money. Let Aurora do the heavy lifting, so you can focus on what matters most.

© 2025 Voxify. All rights reserved.

© 2025 Voxify. All rights reserved.

© 2025 Voxify. All rights reserved.