AgentsAgentBase

set_params

View as MarkdownOpen in Claude

Set multiple AI parameters at once. Merges into any previously set parameters.

These parameters map to the SWML ai.params object. See the SWML AI params reference for the full list of supported fields.

Parameters

params
dict[str, Any]Required

Dictionary of parameter name/value pairs.

Returns

AgentBase — Returns self for method chaining.


AI Parameter Reference

Parameters set via set_params() control the AI model, speech recognition, timing, and agent behavior. The fields below list commonly used parameters by category.

Default values shown below are server-side defaults applied by the SignalWire platform. The SDK itself sends no defaults — only parameters you explicitly set are included in the SWML document.

LLM Parameters

temperature
floatDefaults to 0.3

Output randomness. Range: 0.02.0. Lower values produce more deterministic responses.

top_p
floatDefaults to 1.0

Nucleus sampling threshold. Range: 0.01.0. Alternative to temperature for controlling randomness.

frequency_penalty
floatDefaults to 0.1

Repetition penalty. Range: -2.02.0. Positive values reduce repetition of token sequences.

presence_penalty
floatDefaults to 0.1

Topic diversity. Range: -2.02.0. Positive values encourage the model to explore new topics.

max_tokens
intDefaults to 256

Maximum response tokens. Range: 116385.

ai_model
strDefaults to gpt-4o-mini

AI model to use (e.g., "gpt-4o-mini", "gpt-4.1-mini", "nova-micro", "nova-lite").

Timing Parameters

end_of_speech_timeout
intDefaults to 700

Silence duration in milliseconds to detect end of speech. Range: 25010000.

attention_timeout
intDefaults to 5000

Idle delay in milliseconds before the AI re-prompts the caller. Range: 0600000.

inactivity_timeout
intDefaults to 600000

Inactivity delay in milliseconds before the call is automatically disconnected. Range: 100003600000.

speech_timeout
intDefaults to 60000

Maximum speech duration in milliseconds before the input is finalized.

Behavior Parameters

wait_for_user
boolDefaults to false

Wait for the caller to speak first before the AI begins talking.

conscience
bool | strDefaults to true

Safety enforcement. When enabled, the AI applies content safety filters.

transparent_barge
boolDefaults to true

Transparent barge-in mode. When enabled, caller speech interrupts the AI naturally without discarding context.

save_conversation
boolDefaults to false

Persist the conversation summary after the call ends.

Audio Parameters

ai_volume
intDefaults to 0

AI voice volume adjustment. Range: -5050.

background_file
str

URL of an audio file to play as background audio during the conversation.

hold_music
str

URL of hold music or a tone string (e.g., "tone:440").

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_text("You are a helpful assistant.")
5agent.set_params({
6 "temperature": 0.7,
7 "end_of_speech_timeout": 1000,
8 "attention_timeout": 10000,
9 "wait_for_user": True
10})
11agent.serve()