Agent Builder is in beta. Some features are still in development and are subject to change.

This quickstart walks through building a new agent that summarizes research papers for specific personas within an organization.

You will:

  • Create a new Agent Builder project
  • Clear the demo agent that’s automatically created
  • Build the agent’s UI to accept a research paper and a persona
  • Build the agent’s blueprint to summarize the research paper for the persona and display the results in the UI
  • Preview the agent
  • Deploy the agent

If you are unfamiliar with Agent Builder:

Start an Agent Builder project

To create an agent with Agent Builder, log in to AI Studio and follow these steps:

1

Click the Build an agent button

Click the Build an agent button in the top right of the page.

2

Select Agent Builder

Next, in the modal that appears, select Get started under Agent Builder.

3

Edit the new agent

Writer creates a new agent for you asynchronously. Once the agent is created, you’ll see a message that the agent is ready with a link to the Agent Builder interface. Follow the Start editing link to start building your agent.

4

Return to the Agent Builder interface

You can get to the Agent Builder interface any time by going to the AI Studio homepage and selecting the agent you created.

You’ll see the Configure Deployment page when you select the agent. To get to the edit interface, click the Edit button in the top right corner.

Clear the demo agent

When you create a new Agent Builder project, a demo agent is automatically created for you. You can remove the demo agent’s components and blueprints to start building your own agent.

Clear the UI

From the UI view:

1

Delete the top-level Page element from the Component Tree

Click the Page element from the UI component tree in the bottom left.

Then click the red trashcan icon on the Page’s element settings menu to delete it.

2

Add a new Page

Your Component Tree should now contain a single Root element.

Click Add page at the bottom of the component tree to create a new blank page.

Clear the blueprint

From the Blueprint view:

1

Delete the first element under Blueprints Root

Click the first element under Blueprints Root in the Blueprint component tree in the bottom left. Here, the element is a blueprint called button@click_1.

Then click the red trashcan icon in the blueprint’s settings menu to delete it.

2

Add a new Blueprint

Your blueprint’s component tree should now be empty.

Click Add blueprint at the bottom of the component tree to create a new blank blueprint.

Build the UI

Now that you have an empty page, build the UI for the new agent. This agent will have the following components:

  • A Textarea input for the user to paste their research paper
  • A Dropdown input for the user to select the persona they want to summarize the paper for
  • A Button to start the summarization process
  • A Message component to display a loading message while the summarization is in progress
  • A Text component to display the summary

Add the Textarea input

The Textarea input is where a user can paste their research paper.

In a separate tutorial, you can see how to add a File input to allow users to upload a research paper. For now, you’ll use the Textarea input.

1

Add the Textarea input component to the canvas

Search for the Textarea input component in the component library on the left side of the page. Then click and drag the Textarea input component onto the canvas.

2

Open the Textarea input component settings

Click on the Textarea component you just added to open its settings.

3

Set the label to Research paper

Set the Label to Research paper.

4

Set the binding to research_paper

Under Binding, give the State element the name research_paper. This allows the blueprint to access the value of the research paper whenever the user updates it.

The agent’s state is a set of variables that both the blueprint and the UI can access and update. You can learn more about the agent’s state in Agent state.

The component should now look like this:

Add the dropdown input

The dropdown input is where a user can select the persona they want to summarize the paper for.

1

Add the dropdown input component to the canvas

Search for the Dropdown input component in the component library on the left side of the page. Then click and drag the Dropdown input component onto the canvas.

2

Open the dropdown input component settings

Click on the Dropdown input component you just added to open its settings.

3

Set the label to Persona

Set the Label to Persona.

4

Add the options

Add the options you want to display in the dropdown. For this example, add the following options:

  • Sales
  • Marketing
  • Product
  • Engineering
5

Set the binding to persona

Under Binding, give the State element the name persona. This allows the blueprint to access the value of the persona whenever the user updates it.

The component should now look like this:

Add the summarize button

Next, add a button to the UI that will trigger the summarization process.

1

Add the button component to the canvas

Search for the Button component in the component library on the left side of the page. Then click and drag the Button component onto the canvas.

2

Open the button component settings

Click on the Button component you just added to open its settings.

3

Set the text to Summarize

Set the Text to Summarize.

The component should now look like this:

Add the progress message component

The Message component is helpful for displaying messages to the user. Here, you’ll use it to display a loading message while the summarization is in progress.

1

Add the message component to the canvas

Search for the Message component in the component library on the left side of the page. Then click and drag the Message component onto the canvas.

2

Open the message component settings

Click on the Message component you just added to open its settings.

3

Set the message to status

Set the Message to @{status}. This reads from the status state variable, which the blueprint sets to indicate the progress of the summarization.

The component should now look like this:

Add the summary text component

The Text component is where the blueprint will display the summary of the research paper when it’s complete.

1

Add the text component to the canvas

Search for the Text component in the component library on the left side of the page. Then click and drag the Text component onto the canvas.

2

Open the text component settings

Click on the Text component you just added to open its settings.

3

Set the text to summary

Under Text, enter @{summary}. This displays the value of the summary state variable, which the blueprint sets to the summary of the research paper.

4

Enable markdown

Under Use Markdown, select Yes. This allows you to use markdown formatting in the text.

The component should now look like this:

Build the blueprint

With the UI built, you can now build the blueprint for the new agent.

The blueprint will have the following logic:

  1. The UI Trigger element triggers the blueprint when the user clicks the Summarize button in the UI.
  2. The Set state block sets the progress_message state variable to Summarizing so that the Message component in the UI can display it.
  3. The Text generation block generates a summary of the research paper.
  4. The Set state block sets the summary state variable to the generated summary so that the Text component in the UI can display it.
  5. The Set state block sets the status state variable back to an empty string to clear the loading message from the UI.

Add the UI trigger

1

Add the UI trigger element to the canvas

Search for the UI Trigger element in the blueprints toolkit on the left side of the page. Then click and drag the UI Trigger element onto the canvas.

2

Open the UI trigger element settings

Click on the UI Trigger element you just added to open its settings.

3

Set the component ID to Summarize

Under Component Id, select the button called Summarize.

4

Set the event type to wf-click

Under Event type, select wf-click. This triggers the blueprint when the user clicks the Summarize button in the UI.

The block should now look like this:

Add the set state block for the progress message

1

Add the set state block to the canvas

Search for the Set state block in the blueprints toolkit on the left side of the page. Then click and drag the Set state block onto the canvas.

2

Open the set state block settings

Click on the Set state block you just added to open its settings.

3

Set the state element to status

Under State element, type status.

4

Set the value to Summarizing

Set the Value to % Summarizing. The % symbol indicates that the message should display a dynamic loading symbol.

The block should now look like this:

At this point, you can preview the agent to see the new behavior. When you click the Summarize button, the Message component will display the loading message that you set in the Set state block.

Add the text generation block

1

Add the text generation block to the canvas

Search for the Text generation block in the blueprints toolkit on the left side of the page. Then click and drag the Text generation block onto the canvas.

2

Open the text generation block settings

Click on the Text generation block you just added to open its settings.

3

Enter the prompt

Enter the following under Prompt. This prompt references the research_paper and persona state variables, which you set up in the UI.

Provide a one-paragraph summary and a list of the three most important takeaways from this research paper: @{research_paper}

Provide the summary for the user persona @{persona}
4

Connect the previous set state block to the text generation block

Connect the previous Set state block to this Text generation block by dragging a line from the green dot on the Set state block to the Text generation block.

The block should now look like this:

Once the text generation block finishes, it sets a state variable called results to the generated summary. You can reference this state variable in the next Set state block.

Add the set state block for the summary results

1

Add the set state block to the canvas

Search for the Set state block in the blueprints toolkit on the left side of the page. Then click and drag the Set state block onto the canvas.

2

Open the set state block settings

Click on the Set state block you just added to open its settings.

3

Set the state element to summary

Under State element, type summary.

4

Set the value to results

Set the Value to @{results}. The results state variable is the output of the previous Text generation block.

The block should now look like this:

Add the set state block to clear the status message

1

Add the set state block to the canvas

Search for the Set state block in the blueprints toolkit on the left side of the page. Then click and drag the Set state block onto the canvas.

2

Open the set state block settings

Click on the Set state block you just added to open its settings.

3

Set the state element to status

Under State element, type status.

4

Leave the value blank

Leave the Value blank. This clears the status state variable.

The block should now look like this:

Preview the agent

You’ve now built the UI and blueprint for the new agent. Go to the Preview view to test the agent.

Paste a research paper into the Research paper text area and select a persona from the Persona dropdown. Then click the Summarize button to see the agent summarize the research paper for the selected persona.

Troubleshooting

Logs

If there are any errors, you’ll see an indication in the Log status bar in the bottom right corner of the page.

You can click the Log status bar to expand the logs and see more details.

State explorer

You can use the State explorer to view the state variables and their values. This is helpful when you’re debugging an agent or need to check the state at a given point in the execution.

To access the state explorer, click the State explorer icon in the top right corner of the page.

Deploy the agent

When you’re ready to deploy the agent, click Configure deployment in the top right corner of the Agent Builder interface. You can also access the deployment configuration by going to the AI Studio homepage and selecting the agent you created.

If the agent is not already deployed, you’ll see a toggle bar that says Draft.

To deploy the agent, toggle the bar. Writer will deploy the agent to the Writer cloud, which takes a moment to complete.

When the agent is deployed, the toggle bar will show Deployed. It will also show a list of the teams in your organization, which you can use to grant access to the agent. You must select at least one team before you can view the URL for the deployed agent.

You can also choose to deploy the agent to the Writer Agent Library for the teams you’ve granted access to. These teams will be able to see the agent you’ve created in the main Ask Writer app.

To help teams find the agent, select Edit the agent guide, where you can add a description and other information to help teams use the agent.