Clone the template project
Open the GoRoute support template below, choose a workspace to import it to, and click Import to add it to your workspace. Then, open the project.The template comes pre-configured with a global prompt, instructions, knowledge base content, and playbooks for GoRoute’s driver and courier support. It also includes a pre-built GoRoute authenticator API tool that validates user credentials against the GoRoute API. You’ll build an authentication layer on top of this so the agent knows who it’s talking to before answering any questions.
Clone the GoRoute support template
Pre-configured GoRoute support agent with playbooks and knowledge base content.
Create the initialization workflow
Open the Framework tab in the sidebar and click Add workflow on the initialization node, then Create workflow. Name it “Authentication” and set the LLM description to:Click Create workflow. To open the workflow on the canvas, click the pencil icon next to its name.
Create the Authenticate user playbook
Drag a Playbook step onto the canvas and connect it to the Start chip. Click on the step, select New playbook, and name it “Authenticate user”.Set the LLM description to:Click Create playbook. In the playbook editor, write the following instructions:
Add the GoRoute authenticator API tool
In the Tools panel on the right side of the playbook editor, click + next to Tools, then API to filter to API tools. Select GoRoute authenticator. This API tool is already configured in the template and sends the user’s email and PIN to the GoRoute API. It returns their account details on success, or an error if the credentials are invalid.Once added, you’ll see it listed under Tools. Click on it to inspect its configuration. The tool has two input variables,
email and pin, both set to Agent collect. This means the playbook will automatically collect these values from the conversation and pass them into the tool.Capture the API response
You need to save the user’s account details from a successful API call so the agent can use them later.Click on the GoRoute authenticator tool and press ▶ next to the Capture response option. Enter Then, click Create variable. You should now see
james.wilson@example.com for email and 1234 for pin, then click Run. You should see a 200 OK response with a data object containing the user’s account details.Click on data in the response preview and create a new variable by clicking Create variable. Name it user_data and set the description to:data → user_data listed under Capture response. This means the user’s account details (name, account type, and more) will be automatically saved to the {user_data} variable whenever the API call succeeds.When the credentials are invalid, the API response does not contain a data key, so {user_data} stays empty. You’ll use this in the next step to make sure the playbook can only exit after a successful authentication.Add the exit condition
In the Exit conditions panel on the right side of the playbook editor, click + to add a new exit condition. Name it “User is authenticated” and set the LLM description to:Then add
{user_data} as a required variable on this exit condition. Because {user_data} only gets populated after a successful API call, the playbook can’t exit until the user provides valid credentials. If authentication fails, {user_data} stays empty and the playbook keeps the conversation going.Close the playbook editor to return to the canvas. You’ll see “User is authenticated” appear as a connection point on the Playbook step.Add the success message
Connect the “User is authenticated” exit to a Message step. Set the Message step’s text to the following:Leave the Message step’s output port unconnected. This passes control to the agent after the message is sent.
Test the authentication workflow
Go back to the Agent tab, then click Run in the top-right corner to test your agent. The initialization workflow will start automatically.Test with invalid credentials:Try entering a wrong PIN or a non-existent email. The playbook should let you know the credentials didn’t match and ask you to try again, without leaving the playbook.Test with valid credentials:Use any of the test accounts below:
The playbook should ask for your email and PIN, call the API to validate them, and then show the success message before handing off to the agent.Test the authenticated agent:After successful authentication, try asking a question like “What are the vehicle requirements to drive with GoRoute?” If you authenticated as James Wilson (a driver), the agent should route to the driver support playbook and answer using driver-specific content.
| PIN | Name | |
|---|---|---|
james.wilson@example.com | 1234 | James Wilson |
mei.chen@example.com | 5678 | Mei Chen |
oliver.brown@example.com | 9012 | Oliver Brown |
Tips for building authentication workflows
- The playbook handles the retry loop. The playbook manages the entire authentication conversation, including retries. If the API returns an error, the playbook tells the user and asks them to try again. This keeps the workflow canvas simple.
- Use API tools for authentication. The GoRoute authenticator is an API tool that sends credentials to an external API. You can create your own API tools to connect to any authentication system.
- Capture response data for later. The API tool saves the response to
{user_data}, which your agent can reference in its global prompt and instructions to personalize the conversation. - Initialization workflows run before the agent. Anything you put in the initialization workflow happens before the agent sees any messages. This is useful for gating access, loading context, or sending a static greeting.
- Automate some of these steps. In the real world, you can pass variables directly into the conversation through the web chat widget, or automatically detect a user’s phone number using the
user_idvariable.
What’s next?
You’ve built an initialization workflow that authenticates users before the agent takes over. Explore these resources to go deeper.Initialization workflows
Learn more about initialization workflows and common patterns like loading context, static greetings, and onboarding flows.
API tools
Create custom API tools to connect your agent to any external service.