Many voice agents need to confirm who they’re speaking to before sharing account data, processing requests, or completing transactions. This recipe shows how to collect an identifier, verify it against your backend, and gate the rest of the conversation on the result.Documentation Index
Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
Use this file to discover all available pages before exploring further.
When to use this
Use this pattern when:- The agent handles personal account data (balances, orders, medical records)
- Compliance or security policy requires identity verification before proceeding
- You want to personalize the conversation based on confirmed identity
The complete pattern
Step 1 – Collect the identifier
collect_identifier.”
Step 2 – Verify against the backend
Full flow
Using verified identity downstream
After verification, other functions can checkconv.state.get("identity_verified") before returning sensitive data:
Key decisions
Why format-check before hitting the API?
Why format-check before hitting the API?
A format check in
collect_identifier catches obvious transcription errors (missing digits, wrong separator) before you make an API call that will fail anyway. It also gives the caller a more specific error message — “That doesn’t look like a valid date” rather than a generic “verification failed.”Why store caller_name after verification?
Why store caller_name after verification?
Storing the verified caller’s name in
conv.state lets the agent personalise subsequent responses — “Great, I can see your account, Aaron” — without making a second API call. Only store what you’ll use.Why not use utterance for the failure messages?
Why not use utterance for the failure messages?
For retry messages, returning
content lets the LLM rephrase the request naturally (“Sorry, that didn’t match — could you try your date of birth again?”). Using a hard-coded utterance would make every retry sound identical.Check your understanding
← Retry with handoff
Previous recipe
Intent-based routing →
Next recipe

