The secret_vault function allows you to securely retrieve the contents of secrets added to your account.

Usage

To use the secret_vault function, follow these steps:

Step 1: Import the Function

First, import the secret_vault function into your custom function:

from agent_v3.deployment_service.agents.functions.builtin import (
    secret_vault,
)

Step 2: Use the Function

Next, you can use the secret_vault function to retrieve your secret:

secret_value = secret_vault('name of your secret')

Returns

For Key-Value Type Secret

For a key-value type secret, the function returns a dictionary of key-value pairs. Example:

{
    "secret_key": "secret_value"
}

You can access this like a standard Python dictionary in your function code.

For Single Type Secret

For a single type secret, the function returns the string containing the secret_value. Example:

{
    "secret_key": "secret_value"
}

Tips

  • Check Available Secrets: There is a box called “Secrets” on the top right corner of the “Function Definition” box in the Function Editor. Click that to see what secrets your assistant has access to.
  • Permission Issues: If you cannot see the secret in the “Secrets” box, please refer to the Access Control for Secrets page to add permission for your function.
  • Copy Code Snippet: In the “Secrets” box, you can also copy the code snippet for accessing the secret directly into your function code.