Attributes
id
id
account_id
account_id
ws-) that owns this project. This is the same account ID visible in your Studio URL: https://studio.<region>.poly.ai/<account_id>/... (where <region> is us, uk, or eu — Agent Studio is region-specific).Example:project_id
project_id
https://studio.<region>.poly.ai/<account_id>/<project_id>/... (where <region> is us, uk, or eu — Agent Studio is region-specific).Example:env
env
channel_type
channel_type
"sip.polyai"– Voice calls (telephony/SIP)"webchat.polyai"– Webchat widget"chat.polyai"– Agent Studio in-browser chat"sms.twilio"– SMS text messages
.startswith() for broader matching (e.g., conv.channel_type.startswith("sms")) when you don’t need to distinguish between SMS sub-types.attachments
attachments
Attachment objects queued to be included with the next agent message (list[Attachment]). Append to it with conv.add_attachments(...). Attachments are only supported on webchat channels.Attachment object structure:content_url(str) – URL to the main content of the attachmentcontent_type(str) – The type of the attachment ("image","weblink", or"unspecified")title(str, optional) – Title of the attachmentpreview_image_url(str, optional) – URL to a preview image for the attachmentcall_to_action(str, optional) – Text for the call-to-action button or link
sip_headers
sip_headers
integration_attributes
integration_attributes
- DNIs Pooling – Provides
shared_idfor correlating conversation outcomes
start_function to handle missing data appropriately.Example:caller_number
caller_number
+14155551234 for USA numbers).For outbound calls: The phone number being called by the agent.For chat channels: This may be an email address or integration-provided user ID.Example:callee_number
callee_number
state
state
int for numeric/quantity entities, float for decimal numerics and currency, str for everything else).Access patterns: conv.state supports both bracket and attribute access — pick whichever reads more clearly. Reads and writes behave identically across the two styles:current_flow
current_flow
current_step
current_step
sms_queue
sms_queue
OutgoingSMS / OutgoingSMSTemplate objects queued for dispatch at turn end.variant_name
variant_name
variants
variants
variant
variant
None if no variant has been set. Attribute values are returned as strings (the storage type used by Variants) — parse them yourself if you need structured data. Reading an attribute that doesn’t exist on the active variant returns None, not an AttributeError.Example:sms_templates
sms_templates
voice_change
voice_change
language
language
history
history
handoffs
handoffs
transcript_alternatives
transcript_alternatives
real_time_config
real_time_config
memory
memory
caller_number for voice calls or the integration-provided user identifier for chat channels. This lets the agent recognize returning customers and recall previous interactions.Example:entities
entities
.value is the raw string captured from the caller.For a typed value (int, float, or str) read the entity from conv.state instead — validated entities are auto-synced there under their entity name.Example:functions
functions
api
api
conv.api.{integration_name}.{operation_name}().
Example:integrations
integrations
conv.integrations.{integration_name}.{method}().conv.integrations is for integrations PolyAI has built and maintains (proxied through Paragon). For custom HTTP APIs you define yourself in the APIs tab, use conv.api.webchat
webchat
webchat.polyai channels. Access webchat-only methods via conv.webchat.{method}().Available methods:set_chat_call_actions(actions)– attach click-to-call buttons to the next agent message.
conv.channel_type for clarity.generic_external_events
generic_external_events
generate_external_event. Each event contains ext_event_id, send_to_llm, created_at, data, and content_type.Example:translations
translations
response_suggestions
response_suggestions
agentic_dial
agentic_dial
Methods
say
say
randomize_voice
randomize_voice
- voice_weightings (list[VoiceWeighting]) – list of VoiceWeighting objects, each containing a voice and weight.
polyai.voice module (e.g., ElevenLabsVoice, CartesiaVoice, PlayHTVoice, RimeVoice). See Voice classes for the full list of available voices and their IDs.Example:goto_flow
goto_flow
exit_flow
exit_flow
set_variant
set_variant
add_attachments
add_attachments
content_url(str) – URL to the main content of the attachmentcontent_type(str) – The type of the attachment ("image","weblink", or"unspecified")title(str, optional) – Title of the attachmentpreview_image_url(str, optional) – URL to a preview image for the attachmentcall_to_action(str, optional) – Text for the call-to-action button or link
"weblink"– Displays the title, preview image, and call-to-action text. Clicking navigates the user tocontent_url."image"– Displays the title (if present), but no call-to-action.preview_image_urlshould be a lower resolution image, andcontent_urlshould be the full resolution image. Clicking shows the higher resolution version."unspecified"– No specific rendering behaviour is applied.
discard_recording
discard_recording
generate_external_event
generate_external_event
/v1/external-events/webhook endpoint. The webhook payload is then accessible through conv.generic_external_events.Parameters:- send_to_llm (bool, keyword-only, optional) – if
True, the webhook payload is also sent to the LLM as a system prompt. DefaultFalse.
log_api_response
log_api_response
- Conversation Review: View API responses in the Diagnosis tab for debugging
- Analytics pipeline: API response data is available for reporting and analysis
send_whatsapp
send_whatsapp
content_id that must be referenced when sending.to_number(str) – recipient phone number.from_number(str) – sender phone number (must be WhatsApp-enabled in Twilio).content_id(str) – alphanumeric ID of the approved WhatsApp message template.content(str, optional) – text content. Default"".retry_count(int, optional) – number of retries to attempt on failure.
send_content_template with whatsapp=True.send_content_template
send_content_template
- messaging_service_id (str) – Twilio messaging service ID.
- to_number (str) – recipient phone number.
- content_id (str) – alphanumeric ID of the approved message template.
- content (str, optional) – text content. Default
"". - whatsapp (bool, optional) – set to
Trueto send over WhatsApp. DefaultFalse. - content_variables (dict, optional) – variables to pass to the message template.
send_sms
send_sms
send_sms_template
send_sms_template
write_metric
write_metric
write_metric explicitly from a function whenever you want a metric value captured.Parameters:- name (str) – metric key, as defined in your project’s metrics configuration.
- value (str, int, float, bool, or None) – the metric value. Must match the type defined in the metric spec.
- write_once (bool, optional) – if
True, the metric can only be written once per conversation. Subsequent calls with the same name are ignored. DefaultFalse.
call_handoff
call_handoff
- destination (str) – handoff target key, as defined in your handoff configuration.
- reason (str, optional) – escalation reason. Defaults to the destination name.
- utterance (str, optional) – message for the agent to say before transferring.
- sip_headers (dict[str, str], optional) – SIP headers to pass through. Merged with any headers configured in the handoff config, with passed headers taking precedence.
- route (str, optional) – phone number or route to override the configured route.
utils
utils
get_secret(name)– Retrieve a stored secret by nameextract_address()– Extract postal addresses from user inputextract_city()– Extract city references from user inputprompt_llm()– Perform a standalone LLM requestvalidate_entity()– Validate a value against an entity config (email, phone, date, etc.)
NotImplementedError, contact your PolyAI representative to enable it for your account.Example:set_voice
set_voice
set_language
set_language
set_asr_biasing
set_asr_biasing
- keywords (list[str], optional) – list of keywords to bias ASR recognition toward.
- custom_biases (dict[str, float], optional) – dictionary mapping phrases to bias weights. Example:
clear_asr_biasing
clear_asr_biasing
disable_kb_topics
disable_kb_topics
- topics (list[str]) – Managed Topic names to disable. Replaces any previously disabled list.
clear_disabled_kb_topics
clear_disabled_kb_topics
conv.disable_kb_topics().Example:goto_csat_flow
goto_csat_flow
set_csat_eligibility
set_csat_eligibility
eligible=False, the conversation is excluded from CSAT regardless of call type, percentage rollout, or weekly caps. When eligible=True or this method isn’t called, normal CSAT logic applies.Parameters:eligible(bool) – whether the conversation is eligible for CSAT.reason(str, optional) – reason for the decision (logged for debugging).
set_csat_phone_number
set_csat_phone_number
phone_number(str) – phone number to send the CSAT SMS to, in E.164 format.
set_csat_survey_entered
set_csat_survey_entered
send_email
send_email
- Emails are sent asynchronously after the turn completes
- Delivery failures are logged but do not interrupt the conversation
- For high-volume sending, consider rate limits and reputation management
- to (str) – recipient email address.
- body (str) – raw body of the email.
- subject (str) – subject line.
set_response_suggestions
set_response_suggestions

