How to Create a Custom Agent in Agent Builder?

As a community contributor, I regularly write blog posts based on my real-time experience from client projects and from working on our internal products. Sometimes I write a completely new blog post, and sometimes I update an existing post with new learning and practical experience.

Before writing or modifying a post on SPGuides or EnjoySharePoint, I always need to check whether a similar post already exists. This includes checking the post title, publish date, and the topics already covered. Doing this manually by searching on multiple websites takes a lot of time, especially when I am working on multiple tasks in a client project.

So, I wanted a simple solution where I can just provide a topic name, and the system will:

  • Check whether the post already exists or not
  • Give me the post link
  • Show the publication date
  • List the topics covered in that post

While searching for a solution, I discovered that we can build this using Copilot Studio. However, deploying a Copilot Studio solution requires additional licensing. After further research, I found that we can create a custom agent directly in Microsoft 365 Copilot (Agent Store) without extra complexity.

The best part is that this agent can be shared with:

  • All users in the organization, or
  • Specific users or teams

In this tutorial, I will show you how to create a custom search agent in Microsoft 365 Copilot using Teams. I will also explain how to share this agent with your colleagues.

Create a Custom Agent in Microsoft 365 Copilot

In this example, I will create the same custom agent that I explained in the previous section. If you have a different scenario, you can follow the same steps and customize the agent based on your requirements.

To create the custom agent, follow the steps below.

  1. In your browser, search m365 Copilot. Sign in using your Microsoft 365 account.
Build Your Own AI Agents with Microsoft 365 Copilot

Or you can open Microsoft Teams. From the left menu, select Microsoft 365 Copilot.

Create a Custom Agent in Microsoft 365 Copilot using Teams
  1. Then click New Agent/Create Agent. Here you can see two options: Describe and Configure.
How to Build an AI Agent with Microsoft 365 Copilot

For this example, I am configuring. You can describe, or, if you prefer, try the predefined agent.

  1. Then provide the agent name and description:
    • Name: Blog Post Search Agent
    • Description:
This agent helps you check whether a blog post already exists on SPGuides or EnjoySharePoint.

You just need to provide a post title or topic name, and the agent will search these websites and return the post details, including the post link, publish date, and topics covered.
Build your own agent with Microsoft 365 Copilot

Then you can see the name and description will reflect on the right side of the screen.

  1. Next, add the Instructions. Instructions define how the agent should behave, what input it should take from the user, and how it should generate the output.
Purpose of this agent

You are a content search assistant. Your job is to check whether a specific blog post exists on selected websites and return clear details about it.

What the agent should do

When a user provides a post name or post title, follow these steps:

1. Search for the post only on the following websites:

spguides.com
enjoysharepoint.com

2. Check whether the given post name exists on either of these websites.

3. If the post is found, do the following:

Confirm clearly that the post exists
Provide the full post URL (clickable link)
Show the post publish date
List the main topics or key points covered in the post

4. If the post is not found, do the following:

Clearly say that the post does not exist on the searched websites
Suggest checking the post title spelling or trying a related keyword

Response style guidelines

Use simple and clear English
Be short, accurate, and well-structured
Use bullet points where helpful
Do not guess or make up information
Only return information that is actually found on the websites

Limitations

Do not search outside the two specified websites
Do not create content summaries if the post does not exist
Build Agents with Microsoft 365 Copilot

Next, we need to add the Knowledge section. Knowledge sources indicate where the agent is allowed to search for information.

  1. In this example, I am adding two specific websites as knowledge sources because I want the agent to search only these sites.
Customize Copilot and Create AI Agents

After adding the URLs, make sure Search all websites is turned OFF. Only use specified sources is turned ON.

For now, I am not configuring Capabilities and suggested prompts for this agent. if required, you can enhance this agent by:

  • Adding capabilities to control how the agent behaves
  • Adding suggested prompts to guide users on how to interact with the agent
Create a custom agent from a template in m365
  1. Then click on create, or you can test by giving the prompt. I already tested this, so I clicked the create button.
How to Create a Custom Agent in Microsoft 365 Copilot

After creating the agent, you will see a success confirmation pop-up. From this pop-up, you can:

  • Click Go to agent to test the agent immediately, or
  • Click Share to share the agent with other users
Connect and configure an agent for Teams and Microsoft 365

Test the Custom Agent in Microsoft 365 Copilot

Click Go to agent. Then provide the prompt. For this example, I want to search “How to Set up Manual Authentication in Microsoft Copilot Studio”, present or not.

Create a custom agent in microsoft 365 copilot

Then you can see the result.

Create a Custom Agent using Microsoft 365 Copilot

Then, I am searching for “Change Data Type”, you can see the result.

ow to create custom agents in Microsoft 365 Copilot

This way, you can create your custom agent in M365 Copilot.

Share Custom Agent in Microsoft 365 Copilot

  • Click on All agents.
  • Find your custom agent in the list.
  • Click the three dots (⋯) next to your agent.
  • Select Share.
Share Custom Agent in Microsoft 365 Copilot

After clicking Share, a dialog box will appear where you can control who can access the agent.

You will see the following options:

  • Anyone in your organization: Select this option if you want all users in your organization to use the agent.
  • Specific users in your organization: Select this option if you want to share the agent with selected users only. You can add users by typing their name, group, or email address.
  • Only you: Select this option if you want to keep the agent private.

After selecting the appropriate option:

  • Click Apply.
  • You can also copy the generated agent link and share it directly with your colleagues.
Custom Agent in Microsoft 365 Copilot Share

In this, I am sharing this agent with Patti Fernandez.

If she wants to use this agent, she needs to open the M365 Copilot and click the All agent in the schedule. Then she can see the “Shared with you” section. She can see the agent, then install it, and then use it.

Build Custom Agents in Microsoft 365 Copilot

In this tutorial, we learned how to create a custom search agent in Microsoft 365 Copilot. We saw how to configure the agent, add clear instructions, and limit the knowledge sources to specific websites like SPGuides and EnjoySharePoint. We also tested the agent to check whether a blog post exists and learned how to share the agent with colleagues in the organization.

Also, you may like some tutorials:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App