Integrate Teams with an agent ↗
noOriginal Documentation
Documentation Index#
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt Use this file to discover all available pages before exploring further.
Connect LangSmith Fleet to Microsoft Teams by bringing your own Azure Bot to let agents communicate with users in Teams.
With LangSmith Fleet, you can connect your agents to Microsoft Teams by registering a custom Azure Bot. Once connected, your agents can:
- Receive messages from Teams users, starting a new run with the message content.
- Respond directly in Teams conversations using the Bot Framework.
- Access Teams channels and messages through Microsoft Graph API tools.
In channel conversations, the bot only responds when explicitly mentioned. In direct messages and group chats, the bot responds to all messages.
Prerequisites#
- An existing agent in Fleet (see Quickstart to create one)
- An Azure account with permission to create resources
- Admin access to a Microsoft Teams workspace, or permission to install apps
Create an Azure Bot#
Before registering in Fleet, you need to create an Azure Bot resource and obtain its credentials.
- Go to the Azure Portal.
- Search for Azure Bot and click Create.
- Fill in the required fields:
- Bot handle: A unique identifier for your bot.
- Subscription: Select your Azure subscription.
- Resource group: Create a new one or select an existing one.
- Type of App: Select Multi Tenant.
- Creation type: Select Create new Microsoft App ID.
- Click Review + create, then Create.
After the resource is created:
- Navigate to your bot resource and click Configuration in the left sidebar.
- Copy the Microsoft App ID. You will need this later.
- Click Manage Password next to the App ID.
- Click New client secret, add a description, and click Add.
- Copy the Value of the new secret immediately — it is only shown once.
Copy the client secret value immediately after creation. You cannot retrieve it later. If you lose it, you must create a new one.
You will set the messaging endpoint after registering the bot in Fleet. Skip this field for now—you will return to this step later.
Register the bot in Fleet#
- Navigate to Fleet in the LangSmith UI.
- Go to the Integrations page.
- Click Add Teams App.
Fill in the following fields:
- App Name: A display name for the bot in Fleet.
- Azure App ID: The Microsoft App ID from the Azure Bot resource.
- Azure App Password: The client secret value you copied earlier.
- Azure Tenant ID (optional): Your Azure AD tenant ID. Leave as default for multi-tenant bots.
Click Create to register the bot.
After registration, Fleet displays a webhook URL. Copy this URL—you need it to complete the Azure Bot configuration.
- Return to your Azure Bot resource in the Azure Portal.
- Go to Configuration.
- Paste the webhook URL from Fleet into the Messaging endpoint field.
- Click Apply.
Add the bot to Teams#
- In the Azure Portal, go to your bot resource.
- Click Channels in the left sidebar.
- Select Microsoft Teams and click Apply.
- Agree to the terms of service.
- In Teams, click Apps in the left sidebar.
- Click Manage your apps then Upload an app.
- Upload a Teams app manifest that references your Azure App ID, or use the Open in Teams link from the Azure Bot Channels page.
- Add the bot to the desired team or chat.
Link the bot to an agent#
You can link a Teams bot to an agent from the integrations page or from the agent editor.
Link from the integrations page#
- Navigate to the Teams Apps section on the Integrations page in Fleet.
- Select the bot you want to link.
- From the dropdown menu, choose the agent you want to link to.
Link from the agent editor#
- Select your agent from My Agents in the left-hand navigation.
- Click
Edit Agent. - Scroll to the Channels section.
- Click Teams.
- From the dropdown menu, select the Teams app you want to link.
Add Teams tools#
Tools let your agent take actions in Teams. To respond to messages and interact with Teams, add the relevant tools.
You can also ask your agent to add these tools itself. In the agent chat, try: “Add the Teams tools so you can respond to messages.”
- In the agent editor, scroll to the Tools section.
- Click + Add.
- Search for “Teams” and add the tools you need:
- teams_bot_send_proactive_message — Send messages back to the Teams conversation
- microsoft_teams_list_my_teams — List teams the authenticated user belongs to
- microsoft_teams_list_channels — List channels in a team
- microsoft_teams_post_channel_message — Post a message to a channel
- microsoft_teams_read_channel_messages — Read recent messages from a channel
- If prompted, click Connect to authorize the Microsoft Graph tools.
- Click Save changes.
The teams_bot_send_proactive_message tool uses Bot Framework credentials and does not require separate OAuth authorization. The other Teams tools use Microsoft Graph API and may require OAuth consent.
Configure agent behavior (optional)#
Your agent needs to know how to handle incoming Teams messages. Update its instructions by prompting it directly in the agent chat:
Update your instructions to handle the Teams Trigger and Teams Tools
for bidirectional communicationAdjust the instructions based on your use case—for example, you might want the agent to only respond to certain types of questions, or to pull information from specific sources before replying.
Troubleshooting#
Agent does not respond#
- Check the thread in Fleet for any approvals that need human input.
- In channel conversations, make sure you @mention the bot. Channel messages without a mention are ignored.
- Check the Feed tab for errors.
- Verify the messaging endpoint in the Azure Bot resource matches the webhook URL from Fleet.
- Ensure the bot registration is not paused in Fleet.
Invalid credentials error during registration#
- Verify that the Azure App ID and App Password (client secret) are correct.
- Make sure the client secret has not expired. Create a new secret in Azure if needed.
- Check that the bot type is set to Multi Tenant in Azure.
Bot works in direct messages but not in channels#
- The bot must be explicitly @mentioned in channel conversations.
- Make sure the bot has been added to the team and has permission to read messages in the channel.
Next steps#
Connect additional services to your agent
Set up email, schedule, or webhook channels
Start from a prebuilt agent template
Edit this page on GitHub or file an issue.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.