Agent Configuration Guide
This guide covers creating and managing AI agent configurations using the WIIL Platform JS SDK. Agent configurations define the model, behavior, and capabilities of AI assistants deployed across various channels.
Quick Start​
- TypeScript
- Python
import { WiilClient, LLMType, AssistantType, BusinessSupportServices } from 'wiil-js';
const client = new WiilClient({
apiKey: 'your-api-key',
});
// Get a valid modelId from the support models registry
const model = await client.supportModels.getDefaultMultiMode();
// First, create an instruction configuration
const instruction = await client.instructionConfigs.create({
instructionName: 'Customer Support Instructions',
role: 'Customer Support Agent',
introductionMessage: 'Hello! How can I help you today?',
instructions: 'You are a helpful customer support agent.',
guardrails: 'Always be polite and professional.',
supportedServices: [BusinessSupportServices.APPOINTMENT_MANAGEMENT],
});
// Create an agent configuration
const agent = await client.agentConfigs.create({
name: 'Harper',
modelId: model.modelId,
instructionConfigurationId: instruction.id,
defaultFunctionState: LLMType.MULTI_MODE,
assistantType: AssistantType.GENERAL,
});
console.log('Agent created:', agent.id);
from wiil import WiilClient
from wiil.models.service_mgt import (
CreateAgentConfiguration,
CreateInstructionConfiguration,
)
from wiil.models.type_definitions import (
LLMType,
AssistantType,
BusinessSupportServices,
)
client = WiilClient(api_key='your-api-key')
# Get a valid model_id from the support models registry
models = client.support_models.list()
model = next((m for m in models if m.type == 'multi_mode' and not m.discontinued), None)
# First, create an instruction configuration
instruction = client.instruction_configs.create(
CreateInstructionConfiguration(
instruction_name='Customer Support Instructions',
role='Customer Support Agent',
introduction_message='Hello! How can I help you today?',
instructions='You are a helpful customer support agent.',
guardrails='Always be polite and professional.',
supported_services=[BusinessSupportServices.APPOINTMENT_MANAGEMENT],
)
)
# Create an agent configuration
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='Harper',
model_id=model.model_id,
instruction_configuration_id=instruction.id,
default_function_state=LLMType.MULTI_MODE,
assistant_type=AssistantType.GENERAL,
)
)
print(f'Agent created: {agent.id}')
Prerequisites​
Agent configurations require an Instruction Configuration to be created first. The instruction configuration defines the agent's role, behavior guidelines, and conversation flow.
- TypeScript
- Python
// Get a valid modelId from the support models registry
const model = await client.supportModels.getDefaultMultiMode();
// First, create an instruction configuration
const instruction = await client.instructionConfigs.create({
instructionName: 'Customer Support Instructions',
role: 'Customer Support Agent',
introductionMessage: 'Hello! How can I help you today?',
instructions: 'You are a helpful customer support agent.',
guardrails: 'Always be polite and professional.',
supportedServices: [BusinessSupportServices.APPOINTMENT_MANAGEMENT],
});
// Then create the agent configuration
const agent = await client.agentConfigs.create({
name: 'Harper',
modelId: model.modelId,
instructionConfigurationId: instruction.id,
});
from wiil import WiilClient
from wiil.models.service_mgt import (
CreateAgentConfiguration,
CreateInstructionConfiguration,
)
from wiil.models.type_definitions import BusinessSupportServices
client = WiilClient(api_key='your-api-key')
# Get a valid model_id from the support models registry
models = client.support_models.list()
model = next((m for m in models if m.type == 'multi_mode' and not m.discontinued), None)
# First, create an instruction configuration
instruction = client.instruction_configs.create(
CreateInstructionConfiguration(
instruction_name='Customer Support Instructions',
role='Customer Support Agent',
introduction_message='Hello! How can I help you today?',
instructions='You are a helpful customer support agent.',
guardrails='Always be polite and professional.',
supported_services=[BusinessSupportServices.APPOINTMENT_MANAGEMENT],
)
)
# Then create the agent configuration
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='Harper',
model_id=model.model_id,
instruction_configuration_id=instruction.id,
)
)
Enums​
LLMType​
- TypeScript
- Python
enum LLMType {
STS = 'sts', // Speech-to-speech
TTS = 'tts', // Text-to-speech
STT = 'stt', // Speech-to-text
TRANSCRIBE = 'transcribe', // Transcription
TEXT_PROCESSING = 'text', // Text processing only
MULTI_MODE = 'multi_mode' // Multi-modal (default)
}
from wiil.models.type_definitions import LLMType
# Available values:
LLMType.STS # 'sts' - Speech-to-speech
LLMType.TTS # 'tts' - Text-to-speech
LLMType.STT # 'stt' - Speech-to-text
LLMType.TRANSCRIBE # 'transcribe' - Transcription
LLMType.TEXT # 'text' - Text processing only
LLMType.MULTI_MODE # 'multi_mode' - Multi-modal (default)
AssistantType​
- TypeScript
- Python
enum AssistantType {
PHONE = 'phone', // Phone-based assistant
WEB = 'web', // Web chat assistant
EMAIL = 'email', // Email assistant
GENERAL = 'general' // General purpose (default)
}
from wiil.models.type_definitions import AssistantType
# Available values:
AssistantType.PHONE # 'phone' - Phone-based assistant
AssistantType.WEB # 'web' - Web chat assistant
AssistantType.EMAIL # 'email' - Email assistant
AssistantType.GENERAL # 'general' - General purpose (default)
Agent Configuration Schema​
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Agent name (max 30 characters) |
| modelId | string | Yes | LLM model ID from Wiil model registry |
| instructionConfigurationId | string | Yes | ID of linked instruction configuration |
| defaultFunctionState | LLMType | No | Operational mode (default: MULTI_MODE) |
| assistantType | AssistantType | No | Channel specialization (default: GENERAL) |
| usesWiilSupportModel | boolean | No | Use Wiil's model registry (default: true) |
| requiredModelConfig | object | No | Additional model parameters |
| call_transfer_config | CallTransferConfig[] | No | Phone transfer configurations |
| metadata | object | No | Custom metadata |
CallTransferConfig Schema​
| Field | Type | Required | Description |
|---|---|---|---|
| transfer_number | string | Yes | Phone number to transfer to |
| transfer_type | string | No | 'blind' or 'warm' (default: 'warm') |
| transfer_conditions | string[] | Yes | Conditions that trigger transfer |
CRUD Operations​
Create Agent Configuration​
- TypeScript
- Python
// Get a valid modelId from the support models registry
const model = await client.supportModels.getDefaultMultiMode();
// Create instruction configuration first (see Prerequisites section)
const instruction = await client.instructionConfigs.create({
instructionName: 'Support Agent Instructions',
role: 'Support Agent',
introductionMessage: 'Hello!',
instructions: 'You are a helpful support agent.',
guardrails: 'Be professional.',
supportedServices: [BusinessSupportServices.APPOINTMENT_MANAGEMENT],
});
const agent = await client.agentConfigs.create({
name: 'Harper',
modelId: model.modelId,
instructionConfigurationId: instruction.id,
defaultFunctionState: LLMType.MULTI_MODE,
assistantType: AssistantType.GENERAL,
metadata: { department: 'support', tier: 'premium' },
});
console.log('Created agent:', agent.id);
console.log('Agent name:', agent.name);
from wiil import WiilClient
from wiil.models.service_mgt import (
CreateAgentConfiguration,
CreateInstructionConfiguration,
)
from wiil.models.type_definitions import (
LLMType,
AssistantType,
BusinessSupportServices,
)
client = WiilClient(api_key='your-api-key')
# Get a valid model_id from the support models registry
models = client.support_models.list()
model = next((m for m in models if m.type == 'multi_mode' and not m.discontinued), None)
# Create instruction configuration first (see Prerequisites section)
instruction = client.instruction_configs.create(
CreateInstructionConfiguration(
instruction_name='Support Agent Instructions',
role='Support Agent',
introduction_message='Hello!',
instructions='You are a helpful support agent.',
guardrails='Be professional.',
supported_services=[BusinessSupportServices.APPOINTMENT_MANAGEMENT],
)
)
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='Harper',
model_id=model.model_id,
instruction_configuration_id=instruction.id,
default_function_state=LLMType.MULTI_MODE,
assistant_type=AssistantType.GENERAL,
metadata={'department': 'support', 'tier': 'premium'},
)
)
print(f'Created agent: {agent.id}')
print(f'Agent name: {agent.name}')
Get Agent Configuration​
- TypeScript
- Python
const agent = await client.agentConfigs.get('agent_123');
console.log('Agent name:', agent.name);
console.log('Model ID:', agent.modelId);
console.log('Assistant type:', agent.assistantType);
agent = client.agent_configs.get('agent_123')
print(f'Agent name: {agent.name}')
print(f'Model ID: {agent.model_id}')
print(f'Assistant type: {agent.assistant_type}')
List Agent Configurations​
- TypeScript
- Python
const result = await client.agentConfigs.list({
page: 1,
pageSize: 20,
});
console.log('Total agents:', result.meta.totalCount);
result.data.forEach(agent => {
console.log(`- ${agent.name} (${agent.id})`);
});
from wiil.types import PaginationRequest
result = client.agent_configs.list(
params=PaginationRequest(page=1, page_size=20)
)
print(f'Total agents: {result.meta.total_count}')
for agent in result.data:
print(f'- {agent.name} ({agent.id})')
Update Agent Configuration​
- TypeScript
- Python
const updated = await client.agentConfigs.update({
id: 'agent_123',
name: 'Riley',
metadata: { department: 'sales', updated: true },
});
console.log('Updated name:', updated.name);
from wiil.models.service_mgt import UpdateAgentConfiguration
updated = client.agent_configs.update(
UpdateAgentConfiguration(
id='agent_123',
name='Riley',
metadata={'department': 'sales', 'updated': True},
)
)
print(f'Updated name: {updated.name}')
Delete Agent Configuration​
- TypeScript
- Python
const deleted = await client.agentConfigs.delete('agent_123');
if (deleted) {
console.log('Agent deleted successfully');
}
deleted = client.agent_configs.delete('agent_123')
if deleted:
print('Agent deleted successfully')
Phone Agent with Call Transfer​
Configure call transfer for phone-based agents:
- TypeScript
- Python
// Get a valid modelId from the support models registry
const model = await client.supportModels.getDefaultMultiMode();
// Create phone support instruction configuration first
const phoneInstruction = await client.instructionConfigs.create({
instructionName: 'Phone Support Instructions',
role: 'Phone Support Agent',
introductionMessage: 'Thank you for calling. How can I assist you?',
instructions: 'You are a phone support agent. Be concise and helpful.',
guardrails: 'Transfer to human when requested or for complex issues.',
supportedServices: [BusinessSupportServices.APPOINTMENT_MANAGEMENT],
});
const phoneAgent = await client.agentConfigs.create({
name: 'PhoneSupport',
modelId: model.modelId,
instructionConfigurationId: phoneInstruction.id,
assistantType: AssistantType.PHONE,
call_transfer_config: [
{
transfer_number: '+15551234567',
transfer_type: 'warm',
transfer_conditions: [
'Customer requests human agent',
'Issue requires supervisor approval',
'Technical problem beyond AI capability',
],
},
{
transfer_number: '+15559876543',
transfer_type: 'blind',
transfer_conditions: [
'Billing dispute over $500',
'Legal inquiry',
],
},
],
});
from wiil import WiilClient
from wiil.models.service_mgt import (
CreateAgentConfiguration,
CreateInstructionConfiguration,
)
from wiil.models.type_definitions import (
AssistantType,
BusinessSupportServices,
)
client = WiilClient(api_key='your-api-key')
# Get a valid model_id from the support models registry
models = client.support_models.list()
model = next((m for m in models if m.type == 'multi_mode' and not m.discontinued), None)
# Create phone support instruction configuration first
phone_instruction = client.instruction_configs.create(
CreateInstructionConfiguration(
instruction_name='Phone Support Instructions',
role='Phone Support Agent',
introduction_message='Thank you for calling. How can I assist you?',
instructions='You are a phone support agent. Be concise and helpful.',
guardrails='Transfer to human when requested or for complex issues.',
supported_services=[BusinessSupportServices.APPOINTMENT_MANAGEMENT],
)
)
phone_agent = client.agent_configs.create(
CreateAgentConfiguration(
name='PhoneSupport',
model_id=model.model_id,
instruction_configuration_id=phone_instruction.id,
assistant_type=AssistantType.PHONE,
call_transfer_config=[
{
'transfer_number': '+15551234567',
'transfer_type': 'warm',
'transfer_conditions': [
'Customer requests human agent',
'Issue requires supervisor approval',
'Technical problem beyond AI capability',
],
},
{
'transfer_number': '+15559876543',
'transfer_type': 'blind',
'transfer_conditions': [
'Billing dispute over $500',
'Legal inquiry',
],
},
],
)
)
Complete Example​
Full workflow demonstrating agent configuration lifecycle:
- TypeScript
- Python
import { WiilClient, LLMType, AssistantType, BusinessSupportServices } from 'wiil-js';
const client = new WiilClient({
apiKey: process.env.WIIL_API_KEY!,
});
async function manageAgentConfigurations() {
// 1. Get a valid modelId from the support models registry
const model = await client.supportModels.getDefaultMultiMode();
console.log('Using model:', model.modelId);
// 2. Create instruction configuration first
const instruction = await client.instructionConfigs.create({
instructionName: 'Sales Agent Instructions',
role: 'Sales Representative',
introductionMessage: 'Hi! I can help you find the perfect product.',
instructions: 'You are a knowledgeable sales assistant. Help customers find products that match their needs.',
guardrails: 'Never pressure customers. Be honest about product limitations.',
supportedServices: [BusinessSupportServices.APPOINTMENT_MANAGEMENT],
});
console.log('Instruction created:', instruction.id);
// 3. Create agent configuration
const agent = await client.agentConfigs.create({
name: 'SalesBot',
modelId: model.modelId,
instructionConfigurationId: instruction.id,
defaultFunctionState: LLMType.MULTI_MODE,
assistantType: AssistantType.WEB,
metadata: { department: 'sales', version: '1.0' },
});
console.log('Agent created:', agent.id);
// 4. Retrieve agent by ID
const retrieved = await client.agentConfigs.get(agent.id);
console.log('Retrieved agent:', retrieved.name);
// 5. List all agents
const allAgents = await client.agentConfigs.list({ page: 1, pageSize: 50 });
console.log('Total agents:', allAgents.meta.totalCount);
// 6. Update agent configuration
const updated = await client.agentConfigs.update({
id: agent.id,
name: 'SalesAssistant',
metadata: { department: 'sales', version: '1.1', updated: true },
});
console.log('Updated agent name:', updated.name);
// 7. Clean up - delete agent and instruction
await client.agentConfigs.delete(agent.id);
console.log('Agent deleted');
await client.instructionConfigs.delete(instruction.id);
console.log('Instruction deleted');
}
manageAgentConfigurations().catch(console.error);
import os
from wiil import WiilClient
from wiil.models.service_mgt import (
CreateAgentConfiguration,
CreateInstructionConfiguration,
UpdateAgentConfiguration,
)
from wiil.models.type_definitions import (
LLMType,
AssistantType,
BusinessSupportServices,
)
from wiil.types import PaginationRequest
client = WiilClient(api_key=os.environ['WIIL_API_KEY'])
def manage_agent_configurations():
# 1. Get a valid model_id from the support models registry
models = client.support_models.list()
model = next(
(m for m in models if m.type == 'multi_mode' and not m.discontinued),
None
)
print(f'Using model: {model.model_id}')
# 2. Create instruction configuration first
instruction = client.instruction_configs.create(
CreateInstructionConfiguration(
instruction_name='Sales Agent Instructions',
role='Sales Representative',
introduction_message='Hi! I can help you find the perfect product.',
instructions='You are a knowledgeable sales assistant.',
guardrails='Never pressure customers. Be honest about limitations.',
supported_services=[BusinessSupportServices.APPOINTMENT_MANAGEMENT],
)
)
print(f'Instruction created: {instruction.id}')
# 3. Create agent configuration
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='SalesBot',
model_id=model.model_id,
instruction_configuration_id=instruction.id,
default_function_state=LLMType.MULTI_MODE,
assistant_type=AssistantType.WEB,
metadata={'department': 'sales', 'version': '1.0'},
)
)
print(f'Agent created: {agent.id}')
# 4. Retrieve agent by ID
retrieved = client.agent_configs.get(agent.id)
print(f'Retrieved agent: {retrieved.name}')
# 5. List all agents
all_agents = client.agent_configs.list(
params=PaginationRequest(page=1, page_size=50)
)
print(f'Total agents: {all_agents.meta.total_count}')
# 6. Update agent configuration
updated = client.agent_configs.update(
UpdateAgentConfiguration(
id=agent.id,
name='SalesAssistant',
metadata={'department': 'sales', 'version': '1.1', 'updated': True},
)
)
print(f'Updated agent name: {updated.name}')
# 7. Clean up - delete agent and instruction
client.agent_configs.delete(agent.id)
print('Agent deleted')
client.instruction_configs.delete(instruction.id)
print('Instruction deleted')
if __name__ == '__main__':
manage_agent_configurations()
Best Practices​
-
Create instruction configurations first - Agent configurations require an instruction configuration ID. Always create the instruction before the agent.
-
Use meaningful agent names - Names are limited to 30 characters. Choose descriptive names that indicate the agent's purpose.
-
Match assistantType to deployment - Set the appropriate assistant type for your deployment channel:
PHONEfor voice-based interactionsWEBfor chat widgetsEMAILfor email automationGENERALfor multi-channel or API-only use
-
Configure call transfers for phone agents - When deploying phone agents, set up appropriate transfer conditions to route complex issues to human agents.
-
Use metadata for organization - Store department, version, and other organizational data in the metadata field.
Troubleshooting​
Missing instructionConfigurationId​
Error:
- TypeScript
- Python
WiilValidationError: instructionConfigurationId is required
WiilValidationError: instruction_configuration_id is required
Solution: Create an instruction configuration first and pass its ID:
- TypeScript
- Python
// Get a valid modelId from the support models registry
const model = await client.supportModels.getDefaultMultiMode();
const instruction = await client.instructionConfigs.create({
instructionName: 'My Instructions',
role: 'Assistant',
instructions: 'Be helpful.',
supportedServices: [BusinessSupportServices.APPOINTMENT_MANAGEMENT],
});
const agent = await client.agentConfigs.create({
name: 'MyAgent',
modelId: model.modelId,
instructionConfigurationId: instruction.id, // Required
});
# Get a valid model_id from the support models registry
models = client.support_models.list()
model = next(
(m for m in models if m.type == 'multi_mode' and not m.discontinued),
None
)
instruction = client.instruction_configs.create(
CreateInstructionConfiguration(
instruction_name='My Instructions',
role='Assistant',
introduction_message='Hello!',
instructions='Be helpful.',
guardrails='Be safe.',
supported_services=[BusinessSupportServices.APPOINTMENT_MANAGEMENT],
)
)
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='MyAgent',
model_id=model.model_id,
instruction_configuration_id=instruction.id, # Required
)
)
Invalid modelId​
Error:
- TypeScript
- Python
WiilAPIError: Model not found in registry
WiilAPIError: Model not found in registry
Solution: Use a valid model ID from the Wiil support models registry:
- TypeScript
- Python
// Option 1: Get the default multi-mode model
const model = await client.supportModels.getDefaultMultiMode();
console.log('Model ID:', model.modelId);
// Option 2: List all available models
const models = await client.supportModels.list();
models.forEach(model => {
console.log(`${model.modelId}: ${model.name}`);
});
# Option 1: Find a multi-mode model
models = client.support_models.list()
model = next(
(m for m in models if m.type == 'multi_mode' and not m.discontinued),
None
)
print(f'Model ID: {model.model_id}')
# Option 2: List all available models
for m in models:
print(f'{m.model_id}: {m.name}')
Name Too Long​
Error:
- TypeScript
- Python
WiilValidationError: name must be at most 30 characters
WiilValidationError: name must be at most 30 characters
Solution: Keep agent names concise (30 characters or less):
- TypeScript
- Python
// Bad
const agent = await client.agentConfigs.create({
name: 'Super Advanced Customer Support AI Assistant v2', // Too long!
// ...
});
// Good
const agent = await client.agentConfigs.create({
name: 'CustomerSupportAI', // 17 characters
// ...
});
# Bad
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='Super Advanced Customer Support AI Assistant v2', # Too long!
# ...
)
)
# Good
agent = client.agent_configs.create(
CreateAgentConfiguration(
name='CustomerSupportAI', # 17 characters
# ...
)
)