Nodes
Get Agent Secret#
The Get Agent Secret node retrieves a secret value that has been securely stored for the current agent. This node is useful when you need to access sensitive information like API keys, passwords, or tokens within a spell, without exposing the values directly in the spell's configuration.
Inputs#
flow
(required): The input flow object.name
(optional): The name of the secret to retrieve. If left blank, the node will retrieve the default secret for the agent.
Outputs#
flow
: The output flow object, which includes the retrieved secret value.value
: The retrieved secret value as a string.
Configuration#
This node does not have any additional configuration options.
Usage#
- Add the Get Agent Secret node to your spell.
- Connect the node to the flow from the previous node.
- (Optional) Enter the name of the secret you want to retrieve in the
name
input field. If you leave this blank, the default secret for the agent will be retrieved. - Connect the
value
output to the input of the node where you want to use the secret value.
Example#
Suppose you have an API key stored as a secret for your agent, and you need to use this key to make an HTTP request to a third-party API. Here's how you could use the Get Agent Secret node in your spell:
- Add a Get Agent Secret node and connect it to the flow.
- Enter "api_key" in the
name
input field to specify the name of the secret you want to retrieve. - Add an HTTP Request node after the Get Agent Secret node.
- Connect the
value
output of the Get Agent Secret node to theheaders
input of the HTTP Request node, mapping it to the "Authorization" header. - Configure the rest of the HTTP Request node as needed and run the spell.
The Get Agent Secret node will retrieve the "api_key" secret value, which will then be used as the Authorization header in the HTTP request, without exposing the actual API key value in the spell's configuration.
Best Practices#
- Store sensitive information like API keys, passwords, and tokens as secrets in your agent's configuration, rather than hardcoding them in your spells.
- Give your secrets descriptive names that make it clear what they are used for.
- Be careful not to inadvertently expose secret values by connecting the
value
output to a node that might log or display the value.
Common Issues#
- If you specify a
name
for a secret that doesn't exist, the node will output an empty string for thevalue
. Make sure the secret name you enter matches the name of a secret that has been configured for your agent. - Remember that the Get Agent Secret node only retrieves secrets for the current agent. If you need to access secrets for a different agent, you'll need to use a different instance of the node configured for that agent.