Skip to main content

Ai Parameters

AI Parameters

Summary: Tune conversation behavior with parameters for speech detection, timeouts, barge control, and AI model settings. For a complete parameter reference, see AI Parameters Reference.

Parameter Categories

CategoryKey ParametersPurpose
Speech Detectionend_of_speech_timeout, energy_levelControl when speech ends
Timeoutsattention_timeout, inactivity_timeoutHandle silence and idle callers
Barge Controlbarge_match_string, transparent_bargeManage interruptions
AI Modeltemperature, top_p, max_tokensTune response generation

Setting Parameters

from signalwire_agents import AgentBase


class MyAgent(AgentBase):
def __init__(self):
super().__init__(name="my-agent")
self.add_language("English", "en-US", "rime.spore")

# Set multiple parameters at once
self.set_params({
"end_of_speech_timeout": 600,
"attention_timeout": 15000,
"inactivity_timeout": 45000,
"temperature": 0.5
})

Essential Parameters

Speech Detection

ParameterTypeDefaultDescription
end_of_speech_timeoutint700Milliseconds of silence before speech is complete
energy_levelint52Minimum audio level in dB (0-100)
## Fast response - shorter silence detection
self.set_params({"end_of_speech_timeout": 400})

## Patient agent - longer silence tolerance
self.set_params({"end_of_speech_timeout": 1000})

Timeouts

ParameterTypeDefaultDescription
attention_timeoutint5000Milliseconds before prompting idle caller
inactivity_timeoutint600000Milliseconds before ending call (10 min default)
## Quick service - prompt quickly if silent
self.set_params({
"attention_timeout": 5000, # "Are you there?" after 5 seconds
"inactivity_timeout": 30000 # End call after 30 seconds
})

## Patient service - give caller time to think
self.set_params({
"attention_timeout": 20000, # Wait 20 seconds before prompting
"inactivity_timeout": 60000 # Wait full minute before ending
})

Barge Control

Barge-in allows callers to interrupt the AI while it's speaking.

ParameterTypeDefaultDescription
barge_match_stringstr-Phrase required to trigger barge
transparent_bargebooltrueEnable transparent barge mode
## Require specific phrase to interrupt
self.set_params({
"barge_match_string": "excuse me"
})

AI Model

ParameterTypeDefaultDescription
temperaturefloat0.3Randomness (0-2, higher = more creative)
top_pfloat1.0Nucleus sampling threshold
max_tokensint256Maximum response length
frequency_penaltyfloat0.1Reduce repetitive phrases
## Consistent responses (FAQ bot)
self.set_params({"temperature": 0.2})

## Creative responses (entertainment)
self.set_params({"temperature": 0.9})

## Balanced for customer service
self.set_params({
"temperature": 0.5,
"frequency_penalty": 0.3
})

Use Case Presets

Customer Service

self.set_params({
"end_of_speech_timeout": 600,
"attention_timeout": 12000,
"inactivity_timeout": 45000,
"temperature": 0.5
})

Technical Support

self.set_params({
"end_of_speech_timeout": 800, # Patient for complex explanations
"attention_timeout": 20000,
"inactivity_timeout": 60000,
"temperature": 0.3 # Precise responses
})

IVR Menu

self.set_params({
"end_of_speech_timeout": 400, # Quick response
"attention_timeout": 8000,
"inactivity_timeout": 20000,
"temperature": 0.2 # Very consistent
})

Tuning Guide

If callers are...

ProblemSolution
Being cut off mid-sentenceIncrease end_of_speech_timeout
Waiting too long for responseDecrease end_of_speech_timeout
Not hearing "Are you there?"Decrease attention_timeout
Getting hung up on too fastIncrease inactivity_timeout

If responses are...

ProblemSolution
Too repetitiveIncrease frequency_penalty
Too random/inconsistentDecrease temperature
Too predictableIncrease temperature
Too longDecrease max_tokens

Complete Example

#!/usr/bin/env python3
## configured_agent.py - Agent with AI parameters configured
from signalwire_agents import AgentBase


class ConfiguredAgent(AgentBase):
def __init__(self):
super().__init__(name="configured-agent")
self.add_language("English", "en-US", "rime.spore")

self.set_params({
# Speech detection
"end_of_speech_timeout": 600,

# Timeouts
"attention_timeout": 15000,
"inactivity_timeout": 45000,

# AI model
"temperature": 0.5,
"frequency_penalty": 0.2
})

self.prompt_add_section(
"Role",
"You are a helpful customer service agent."
)


if __name__ == "__main__":
agent = ConfiguredAgent()
agent.run()

More Parameters

For the complete list of all available parameters including:

  • ASR configuration (diarization, smart formatting)
  • Audio settings (volume, background music, hold music)
  • Video parameters
  • Advanced behavior controls
  • SWAIG control parameters

See the AI Parameters Reference in the Appendix.