How to handle multiple agent configurations for different customers

This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.

What’s the ideal setup for handling multiple agent configs for different customers?

Our customers each have their own config with different prompts and functions. When one of their clients calls their Twilio phone number, we need to load their specific config and handle the call with their customizations.

A common approach is to map the configuration to the phone number for each organization.

When a call is made:

  1. Get the called phone number from participant attributes
  2. Use that number to look up the customer’s configuration
  3. Load and apply the config for that customer

You can either:

  • Have a backend service that returns configuration given a phone number
  • Start with a simple hardcoded dictionary in your agent code and evolve from there

The phone number can be retrieved from the room name or from participant.attributes.get("sip.trunkPhoneNumber").