Skip to main content

Workflows

We don't have favorites, but Workflows might be the closest thing to our favorite primitive in all of Command AI. Why? It doesn't even have that cool of a name?

Workflows combine multiple primitives to allow Copilot to surgically handle specific user scenarios. Think of them as a "scenario card" you might provide to a support team member. "When the user wants to cancel, here are the steps you should take".

Let's dive into how they work and why we're so jazzed about them.

Workflow anatomy

Workflows consist of two pieces:

  • Trigger: this describes when the workflow should be used. A good practice here is to mention words that suggest Copilot should use this workflow.
  • Prompt: this is a natural language description of what to do. This commonly involves a series of steps. First do this, then do this, etc.

The magic of a workflow lies in the prompt. In the prompt, you can tag other Copilot primitives to use. Let's build an example workflow to see how this works.

First, let's build the trigger. We'll keep it pretty simple. "Use this workflow whenever the user asks to initiate a cancellation or a refund of their account."

Now, let's build the prompt. First, we'll tell Copilot to check if the user is eligible for a refund. To do this, we'll tag the API endpoint that is used to grab the user's account information.

"First, check whether the user is eligible for a refund using @Get user account information. If they are, then proceed to step 2. Otherwise, tell the user they aren't eligible. If they complain, then @Handoff to a human."

This step encodes a lot of coolness. Copilot is going to use the API endpoint we tagged, and interpret the return values itself. We didn't have to tell it how to do that. All the information it needs is contained within the definition of the API. If it needs to ask the user for information before using that API endpoint (like asking for the user's account number), it will do that without us needing to be explicit about it.

Also, notice that @handoff tag. This isn't an API, but a suggestion to perform human agent handoff.

"Step 2: If they are eligible for a cancelation, then use @initiate cancellation to process the refund."

Same stuff here. We're tagging an API endpoint, and we'll let Copilot deal with the particulars of calling that endpoint.

What can be tagged into a workflow?

The full list of what can be tagged into a workflow currently is:

  • Suggest the user visit a page
  • Suggest the user initiate a nudge
  • Open third-party chat
  • Initiate human agent handoff
  • Exit workflow
  • Switch to another workflow (workflow-ception!)
  • Open Spotlight

How do I debug a workflow?

X-ray is a great way to debug a workflow. In particular, X-ray's description of its logic can provide insight into corner cases that might not be handled correctly in your workflow.