Build your first agent
Attach from knowledge
Build your own agents/Build your first agent

Build your first agent

10 min
Gaëlle CaplierGaëlle Caplier

1. How to build a custom AI agent?

1.1. The components of a custom AI agent

A custom agent is made of several components:
  • A name, which you will use to call it in your conversations
    • ⚠️ The name needs to be unique on the workspace
    • ⚠️ Your company may have some specific naming standards for your agents: check out the name formats in your agent library!
  • Custom instructions, where you define exactly what the agent should do, which role it should take, which output it should produce, etc.
  • The underlying AI model, which you can pick in a large list of available LLMs.
  • Knowledge sources, where you will select which data sources your agent can leverage to answer user queries.
  • Capabilities, which are the “superpowers” of your agent. You can allow it to take actions for you - like browsing the web, drafting emails in your inbox, updating fields in your CRM, and more!

1.2. The agent builder

When you start creating a new agent, you will be brought to the agent builder interface. It is made of four main sections, which map to the main components of a custom agent.
In the Instructions section, you will write your custom instructions.
  • 📚 Instructions are written in natural language, but there are some best practices to follow to write effective custom instructions. Check them out!
  • 💡 You can use AI to help you refine your instructions! Check out available agents on your workspace: is there one to help you write instructions? At Dust, we call that agent the promptWriter, but yours may have a different name.
The Advanced button above the Instructions box will let you change the underlying AI model used by your agent, if you wish.
Below instructions, you have the Spaces section.
This section will only be relevant if you are a member of a restricted space, e.g. a space that contains private data that your administrator has decided to only open to a specific set of Dust users. How do you know if that's your case? Simply click on Manage: if there's nothing to select here, then you don't have access to any restricted space, and you don't need to change anything in your agent!
Below, you have the Capabilities and Knowledge section. This is where you're going to pick what data your agent can access, and which actions it can take. We'll cover how to add knowledge and capabilities to your agents in the next chapters of this course.
Then, you'll find the Triggers section, where you can choose to automate your agent. We will cover this in the next course, feel free to ignore this section for now.
Finally, the last section in the agent builder is the Settings, where you'll choose a name for your agent, a description, and you'll define its sharing parameters. An Unpublished agent is only available to you, its creator. Keep your agents unpublished during their testing phase. Once an agent is ready to be released and used by your colleagues, switch it to Published to open it to everyone on the workspace.
You can also add some tags to organize your agent library, and make other colleagues editors of your agent.

1.3. In action - Building a search agent

2. When should you create a custom agent?

As you've seen in previous courses, there are a lot of use cases you can address simply with the @dust agent or the @deep-dive agent, which are available by default on your Dust workspace. If you need those agents to have extra capabilities, you can always add them manually in the context of your conversation.
So when do you actually need to create a custom agent? The key word here is recurrence.
  • For any kind of recurring task, you will want to create a custom agent, because it will always know what to do and how to address your specific needs thanks to its custom instructions. You will not need to provide context again and again with each new conversation.
  • For any kind of one-time task, simply talking to @dust or a similar agent is more than enough!
And how about the case when you started from a one-time task, had a long discussion with @dust that evolved into a more and more complex and high-value use case, and you would like to package that one into a new custom agent? In this case, you can simply ask @dust at the end of your conversation to give you recommendations on how to transform the conversation into a new custom agent!

3. Hands-on: build your @askHR agent

The objective of this hands-on is to build an agent to answer simple HR questions from coworkers. It presupposes that you have a source of truth for HR processes connected to Dust, that you can use as a knowledge source for your agent. If that's not your case, you can adapt the use case to build @askProduct, @askCustomerSuccess, @askLegal, or anything else relevant to you!
There might already be an @askHR (or equivalent) agent on your workspace: this hands-on is just for practice, it's not to replace your existing agents, so don't forget to archive your agent if you have no further use for it after this tutorial!

3.1. Create a new agent

From the Dust homepage, click on "Create", then create an agent from scratch. This will bring you to the Agent builder interface.

3.2. Instructions

Write your agent instructions. Don't forget: you should cover the following points:
  • Role of the agent - ex: "Act as an HR specialist"
  • Process to follow - ex: "Find relevant information about our HR processes based on internal documentation"
  • Expected output and constraints - ex: "Reply in less than 200 words"
  • DOs and Don'ts - ex: "Do cite your sources. Don't invent anything."
Of course, you can always use the @promptWriter (or equivalent) agent to help you write instructions!
Alternatively, here is a set of instructions you can use. Adapt them to your own needs!
You are AskHR, an expert HR assistant specialized in answering questions about company HR processes. Your knowledge base consists of a set of Notion pages containing official HR documentation.
Your objectives: - Provide clear, accurate, and concise answers to user questions based solely on the information found in the Notion pages. - If a question cannot be answered with the available documentation, state this clearly and suggest the user contact HR for further assistance. - Never speculate or provide unofficial advice. - Always cite the relevant section or page title from Notion when possible.
Instructions: 1. Read and understand the user's question. 2. Search the Notion documentation for relevant information about the HR process in question. 3. If you find a clear answer: - Summarize the process or policy in your own words. - Include direct quotes or key bullet points from the Notion pages when appropriate. - Reference the Notion page title or section where the answer was found. 4. If the answer is not present or is ambiguous in the documentation: - Respond: "I could not find a definitive answer in the current HR documentation. Please reach out to the HR team for further assistance." 5. Never invent information or provide personal opinions.
Think step-by-step: - First, analyze the user's question and identify the HR process involved. - Next, search the Notion documentation for relevant and up-to-date information. - Then, compose a clear and accurate answer, citing the source. - If in doubt, instruct the user to contact HR.
If you are unsure about any part of the task or the documentation appears incomplete, state your uncertainty and explain why.
Never answer questions outside the scope of HR processes as documented in Notion.

3.3. Spaces

You probably don't have to change anything in the Spaces section. This is only for agents dealing with confidential data!

3.4. Capabilities and knowledge

Under "Knowledge", pick the right data describing your HR processes. In our case, that's a set of pages in Notion called the "HR Corner", but your may live in a different location!
⚠️ Only select the data you need, no more but no less! Giving too much data to an agent may decrease its performances by introducing noise.
You will need to add a short description of the data you have selected. This description will be used by the agent to understand when it is relevant to search in that specific set of knowledge, so be precise!

3.5. Settings

Skip the "Triggers" section - your agent doesn't need one! If you're intrigued by this feature, we'll cover it in-depth in a follow-up course.
Give a name to your agent. If @askHR is already taken, you'll need to pick something else!
The description should be auto-generated, but you may want to review and update it if needed.
You can add more editors and choose to publish your agent, and use tags to classify it.
When everything is ready, just save your agent!

3.6. Try it out!

Try out your agent directly in the Dust homepage. Ask any question about HR processes you want :)
Good job on building your first agent! 🤖

Test Your Knowledge

Answer 5 questions — score 3 or more to pass

Ready to test your understanding of this chapter?