gapuyyy
gapuyyy3mo ago

How to use Secrets in API tool from AI agent (not API block)

I can use the secrets on the API block, but it seems that I cannot find a way to use the secrets if I'm using the API tool inside an AI agent. Do anyone knows if this is possible? Thanks,
7 Replies
Tico | Voiceflow Assistant
Yes – you can call your project Secrets from an API tool that lives inside an Agent step the same way you would in a stand-alone API block. How to insert a secret 1. Make sure the secret already exists (Agent Settings → SecretsNew Secret). 2. Open the Agent step, click Add tool → API (or edit an existing API tool). 3. In any field that accepts a value – URL, header value, query string, request body, etc. – type the first curly brace {. 4. The variable picker appears. At the top switch from Variables to Secrets and choose the secret you want. 5. Voiceflow will insert the placeholder {{YOUR_SECRET_NAME}}. When the agent runs, the real value (or the environment override) is injected, so the user never sees it. Tips • The picker will only show up after you have created at least one secret. • Environment overrides you set in Agent Settings → Environments are also respected when the API tool executes inside the Agent. • If you still don’t see the dropdown, double-check that you are typing the brace inside a value field (not the key/label column). Docs: https://docs.voiceflow.com/docs/secrets → “Using Secrets in Function and API Steps” So you don’t need a separate API block – just drop the secret into the API tool inside your Agent and it will resolve at runtime.
gapuyyy
gapuyyyOP3mo ago
No description
No description
gapuyyy
gapuyyyOP3mo ago
Does anyone have any idea regarding this?
W. Williams (SFT)
You pass it as a variable into your function
gapuyyy
gapuyyyOP2mo ago
oh so for the API tool, it's not supported yet to use secrets (we can only use regular variables)?
W. Williams (SFT)
No you can use a secret, you just have to pass it into a function / tool as a input.
gapuyyy
gapuyyyOP2mo ago
Oh yeah you're right, thanks!

Did you find this page helpful?