Rate this page:

TaskRouter Python Quickstart


TaskRouter is a system for assigning tasks of any type to the people and processes that can best handle them.

As an example, imagine you are building a multi-channel sales and technical support system. Your agents possess unique skills, are based in different locations and operate on different schedules. For each incoming call, email or tweet, you need to determine the best agent to route it to while monitoring the dynamic availability of agents.

Systems of this type are difficult to build and to operate at scale; complex state data needs to be maintained, queried and updated frequently.

TaskRouter bears the burden of this complexity, allowing you to spend less time on infrastructure plumbing and more time engineering a great customer experience.

In this Quickstart tutorial we will build a simplified version of the example scenario in four parts. The tutorial is optimized to follow from start-to-finish:

Keeping it simple:

  • We'll use just two agents to simulate our workforce
  • We'll stick to a single communications channel – voice calls
  • We won't discuss all of TaskRouter's capabilities. For that, check out the reference documentation.


  • A working Python server
  • If you are running your Python server locally (as we will in the examples), you'll need a tool such as ngrok to allow Twilio's servers to interact with your code


  • Code and commands are written in fixed width
  • When following a code sample, check for {curly braces} - this means you need to substitute a value from your own TaskRouter account
  • Supplemental information is provided in blockquotes:

On to Part 1: Setting up a TaskRouter Workspace »

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.


        Thank you for your feedback!

        We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more