phonic
Version:
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPhonic-Co%2Fphonic-node) [ • 12.2 kB
TypeScript
import type * as Phonic from "../../../../index.js";
/**
* @example
* {
* project: "main",
* name: "updated-support-agent",
* phone_number: "assign-automatically",
* timezone: "America/Los_Angeles",
* voice_id: "sabrina",
* audio_speed: 1,
* background_noise_level: 0,
* generate_welcome_message: false,
* is_welcome_message_interruptible: true,
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
* template_variables: {
* "customer_name": {
* default_value: "David"
* },
* "subject": {
* default_value: "Chess"
* }
* },
* tools: ["keypad_input"],
* generate_no_input_poke_text: false,
* no_input_poke_sec: 30,
* no_input_poke_text: "Are you still there?",
* default_language: "en",
* additional_languages: ["es"],
* multilingual_mode: "request",
* push_to_talk: false,
* boosted_keywords: ["Load ID", "dispatch"],
* pronunciation_dictionary: [{
* word: "Phuket",
* pronunciation: "Poo-ket"
* }],
* min_words_to_interrupt: 1,
* configuration_endpoint: {
* url: "https://api.example.com/config",
* headers: {
* "Authorization": "Bearer token123"
* },
* timeout_ms: 7000
* }
* }
*/
export interface UpdateAgentRequest {
/** The name of the project containing the agent. Only used when `nameOrId` is a name. */
project?: string;
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
name?: string;
/** URL-friendly agent slug. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
slug?: string;
/** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
phone_number?: UpdateAgentRequest.PhoneNumber | null;
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
custom_phone_number?: string | null;
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
custom_phone_numbers?: string[];
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
timezone?: string;
/** The voice ID to use. */
voice_id?: string;
/** The audio format of the agent. */
audio_format?: UpdateAgentRequest.AudioFormat;
/** The audio speed of the agent. */
audio_speed?: number;
/** The background noise level of the agent. */
background_noise_level?: number;
/** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */
background_noise?: UpdateAgentRequest.BackgroundNoise | null;
/** When `true`, the welcome message will be automatically generated and the `welcome_message` field will be ignored. */
generate_welcome_message?: boolean;
/** When `false`, the welcome message will not be interruptible by the user. */
is_welcome_message_interruptible?: boolean;
/** Number of seconds of inactivity before the conversation WebSocket is closed. */
websocket_timeout_sec?: number;
/** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */
welcome_message?: string;
/** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
system_prompt?: string;
/** Variables that can be used in the welcome message and the system prompt. */
template_variables?: Record<string, UpdateAgentRequest.TemplateVariables.Value>;
/** Array of built-in or custom tool names to use. */
tools?: UpdateAgentRequest.Tools.Item[];
/** Array of task objects with `name` and `description` fields. */
tasks?: Phonic.Task[];
/** Whether to have the no-input poke text be generated by AI. */
generate_no_input_poke_text?: boolean;
/** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
no_input_poke_sec?: number | null;
/** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
no_input_poke_text?: string;
/** Seconds of silence before ending the conversation. */
no_input_end_conversation_sec?: number;
/** When `true`, the assistant will produce backchannel responses (e.g. "mm-hmm") while the user is speaking. */
enable_assistant_backchannel?: boolean;
/** How aggressively the assistant produces backchannel responses. Only relevant when `enable_assistant_backchannel` is `true`. */
assistant_backchannel_aggressiveness?: number;
/** Controls how long transcripts and audio recordings are retained before deletion. */
data_retention_policy?: Phonic.DataRetentionPolicy;
/** Pool of phone numbers used for outbound calls. Set to `null` to remove the pool. */
outbound_number_pool?: Phonic.OutboundNumberPool | null;
/** Array of procedure IDs associated with the agent. */
procedure_ids?: string[];
/** Array of third-party integrations enabled for the agent. */
integrations?: Phonic.AgentIntegration[];
/** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
default_language?: Phonic.LanguageCode;
/** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
additional_languages?: Phonic.LanguageCode[];
/** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
languages?: Phonic.LanguageCode[];
/** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */
multilingual_mode?: UpdateAgentRequest.MultilingualMode;
/** Push to talk mode. User must send mute/unmute messages to turn on/off listening to audio. Defaults to false. */
push_to_talk?: boolean;
/** The intelligence level of the agent. `high` uses a more capable model for more complex reasoning, while `standard` is optimized for lower latency. */
intelligence_level?: UpdateAgentRequest.IntelligenceLevel;
/** These words, or short phrases, will be more accurately recognized by the agent. */
boosted_keywords?: string[];
/** Array of `{ word, pronunciation }` entries. Words must be unique. */
pronunciation_dictionary?: UpdateAgentRequest.PronunciationDictionary.Item[];
/** Minimum number of words required to interrupt the assistant. */
min_words_to_interrupt?: number;
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
/** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Requires `phone_number` to be set when less than 1.0. */
inbound_rollout?: number;
/** E.164 formatted phone number where non-agent calls will be forwarded. Required when `inbound_rollout < 1.0`, must be `null` when `inbound_rollout = 1.0`. */
inbound_rollout_forward_phone_number?: string | null;
/** Voice activity detection prebuffer duration in milliseconds. */
vad_prebuffer_duration_ms?: number;
/** Minimum speech duration for voice activity detection in milliseconds. */
vad_min_speech_duration_ms?: number;
/** Minimum silence duration for voice activity detection in milliseconds. */
vad_min_silence_duration_ms?: number;
/** Voice activity detection threshold. */
vad_threshold?: number;
/** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
enable_redaction?: boolean;
/** Array of MCP server IDs to make available to the agent. */
mcp_server_ids?: string[];
/** Names of observability integrations to enable for the agent. Each must be one of the supported providers. */
observability_integrations?: "braintrust"[];
}
export declare namespace UpdateAgentRequest {
const PhoneNumber: {
readonly AssignAutomatically: "assign-automatically";
readonly Custom: "custom";
};
type PhoneNumber = (typeof PhoneNumber)[keyof typeof PhoneNumber];
/** The audio format of the agent. */
const AudioFormat: {
readonly Pcm44100: "pcm_44100";
readonly Pcm24000: "pcm_24000";
readonly Pcm16000: "pcm_16000";
readonly Pcm8000: "pcm_8000";
readonly Mulaw8000: "mulaw_8000";
};
type AudioFormat = (typeof AudioFormat)[keyof typeof AudioFormat];
/** The background noise type. Can be "office", "call-center", "coffee-shop", or null. */
const BackgroundNoise: {
readonly Office: "office";
readonly CallCenter: "call-center";
readonly CoffeeShop: "coffee-shop";
};
type BackgroundNoise = (typeof BackgroundNoise)[keyof typeof BackgroundNoise];
namespace TemplateVariables {
interface Value {
default_value: string;
is_boosted_keyword?: boolean | undefined;
}
}
type Tools = Tools.Item[];
namespace Tools {
type Item = "keypad_input" | "natural_conversation_ending"
/**
* Custom tool */
| string;
}
/** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */
const MultilingualMode: {
readonly Auto: "auto";
readonly Request: "request";
readonly Initial: "initial";
};
type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
/** The intelligence level of the agent. `high` uses a more capable model for more complex reasoning, while `standard` is optimized for lower latency. */
const IntelligenceLevel: {
readonly Standard: "standard";
readonly High: "high";
};
type IntelligenceLevel = (typeof IntelligenceLevel)[keyof typeof IntelligenceLevel];
type PronunciationDictionary = PronunciationDictionary.Item[];
namespace PronunciationDictionary {
interface Item {
word: string;
pronunciation: string;
}
}
/**
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
*/
interface ConfigurationEndpoint {
/** URL to call */
url: string;
/** Object of key-value pairs. */
headers?: Record<string, string> | undefined;
/** Timeout in milliseconds for the endpoint call. */
timeout_ms?: number | undefined;
}
}