Share via

Microsoft Foundry V2: Inconsistent behavior of Teams Bot

Dinakar 0 Reputation points
2026-02-12T10:36:37.33+00:00

I am experiencing inconsistent behavior with an agent published from Microsoft Foundry V2(new foundry) and deployed a Microsoft Teams bot.

Observed Behavior

When initiating a 1:1 (personal) chat with the bot, I receive the following error:

Encountered error=Exception of type 'Agents.ActivityProtocol.AgentsV2InvocationUserException' was thrown.
If issue persists, please use the following identifiers in any support request:
ConversationId = '<my conversation-id>', ActivityId = '<my activity-id>'

However, when the bot is mentioned in a Teams channel using:

@botname 'my_question'

the bot processes the request correctly and replies in a separate thread as expected.

Additional Context

The bot was functioning initially after assigning the appropriate Managed Identity (MI).

The issue is isolated strictly to the 1:1 personal chat scope.

Channel invocation via @mention works consistently.

  • The error appears only when the agent has tools attached.
  • The error does not appear if the agent when published has no tools are removed, the bot responds normally in 1:1 chat as a standard chatbot.

What could cause Agents.ActivityProtocol.AgentsV2InvocationUserException to occur only in personal (1:1) chat while channel mentions work correctly?

Specifically:

Are there differences in activity routing or invocation handling between personal scope and channel scope that could trigger this exception?

Could this be related to how tool execution is authorized or invoked in personal chat context?

  • Any extra steps to be followed from the Teams end for 1:1 chat?

My primary goal is to understand what configuration or architectural change is required to enable the bot to function correctly in 1:1 chat, just as it does when mentioned in a channel.

If this behavior is expected due to platform constraints, I would appreciate clarification. Otherwise, I am looking for specific troubleshooting steps, configuration checks, or best practices that would help resolve the error and ensure consistent behavior across both personal and channel scopes.

Any guidance on how to make the bot work reliably in 1:1 chat would be greatly appreciated.

Azure AI services
Azure AI services

A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.

{count} votes

2 answers

Sort by: Most helpful
  1. SRILAKSHMI C 14,815 Reputation points Microsoft External Staff Moderator
    2026-02-25T11:21:03.5966667+00:00

    Hello Dinakar,

    Welcome to Microsoft Q&A and Thank you for reaching out.

    I understand that you're having some trouble with your Teams bot, specifically with 1:1 chats throwing an exception.

    This strongly suggests a scope-specific invocation or authorization issue, rather than a general Foundry or Teams bot failure.

    What’s Happening

    Difference in Invocation Context

    Teams routes activities differently depending on scope.

    Channel context Includes team and channel identifiers

    App is installed at team level

    Strong tenant + team context available

    Tool execution often inherits team-installed permissions

    Personal (1:1) context:

    No teamId or channelId

    Different activity payload

    Different token claims

    May lack team-scoped permissions

    If your tool assumes the presence of:

    teamId

    channelId

    Team-level Graph permissions

    Team-installed app state

    it will work in channel scope but fail in personal scope.

    This can trigger AgentsV2InvocationUserException during tool invocation.

    Tool Execution Authorization Differences

    Since the error only appears when tools are attached, the failure is likely happening during:

    Tool authorization

    Identity resolution

    On-behalf-of (OBO) token flow

    Downstream API call execution

    In personal scope:

    User consent may be required separately

    Delegated permissions may not be granted

    Resource-Specific Consent (RSC) may not apply

    If your tool calls:

    Microsoft Graph

    SharePoint

    Teams APIs

    Custom secured APIs

    verify that delegated permissions and consent apply to personal scope as well.

    Managed Identity (MI) Considerations

    You mentioned the bot worked after assigning the correct Managed Identity.

    Please verify The Managed Identity has required role assignments, Any downstream API permissions apply outside team scope, The tool does not depend on team-level RBAC

    Sometimes MI works in channel scope because resources are team-bound, but fails in personal scope due to missing context.

    Teams App Manifest Configuration

    Confirm your Teams app manifest includes:

    "bots": [
    

    Also verify webApplicationInfo is correctly configured (if using SSO)

    Proper AAD app ID is referenced

    Required Graph delegated permissions are granted

    Admin consent is completed

    Tool Code Assuming Team Context

    A very common issue:

    Tool logic assumes:

    context.teamId exists

    context.channelId exists

    In 1:1 chat, those values are null.

    If your tool execution pipeline attempts to access team-specific resources without null handling, it will throw during invocation.

    You should explicitly handle scope differences:

    • If team context exists → execute team logic
    • If personal scope → execute user-scoped logic

    Logging & Diagnostics

    Enable detailed logging (Application Insights recommended) and compare:

    Working channel invocation vs failing personal invocation.

    Log:

    Incoming activity payload

    Claims principal

    Tenant ID

    Conversation ID

    Tool execution stage

    Token acquisition result

    You will likely observe missing claims or failed token acquisition in personal scope.

    Is This Expected Behavior?

    No, agents should work in both scopes.

    However, tools that depend on:

    Team context

    Team-installed permissions

    RSC

    Delegated Graph access without proper consent

    Improperly handled null team identifiers

    can fail specifically in personal scope.

    Recommended Troubleshooting Sequence

    Confirm Teams app manifest includes "personal" scope

    Verify delegated Graph/API permissions and admin consent

    Compare activity payloads between channel and personal

    Validate OBO flow works in personal scope

    Check tool code for assumptions about team context

    Review Managed Identity RBAC assignments

    Enable detailed logging and inspect invocation pipeline.

    Please refer this

    I Hope this helps. Do let me know if you have any further queries.

    Thank you!

    0 comments No comments

  2. Q&A Assist
    2026-02-12T10:36:53.1266667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error Agents.ActivityProtocol.AgentsV2InvocationUserException occurring specifically in a 1:1 personal chat context while the bot operates correctly in a channel mention could be attributed to several factors related to how Teams handles activities and permissions in different scopes.

    1. Activity Routing Differences: In Microsoft Teams, the routing of activities can differ between personal chats and channel interactions. Personal chats may have different authorization requirements or context that could lead to exceptions when the bot is invoked. The bot might not be handling the specific context of a personal chat correctly, especially when tools are involved.
    2. Tool Execution Authorization: If the bot has tools attached, the way those tools are invoked or authorized may differ in personal chat versus channel scope. It’s possible that the bot is failing to properly authenticate or authorize the tool execution in a personal chat context, leading to the exception.
    3. Configuration Checks: Ensure that the bot's configuration allows for personal chat interactions with tools. This includes verifying that the Managed Identity (MI) has the necessary permissions and that the bot is correctly registered to handle personal chat requests.
    4. Troubleshooting Steps:
      • Check the bot's logs to see if there are any specific error messages or stack traces that provide more context on the failure in personal chat.
      • Test the bot without tools in the personal chat to confirm that the issue is indeed related to tool execution.
      • Review any recent changes in the bot's configuration or permissions that might have affected its ability to interact in personal chats.
    5. Best Practices:
      • Implement error handling in your bot to gracefully manage exceptions and provide meaningful feedback to users.
      • Consider logging additional telemetry data to help diagnose issues that occur in different scopes.
      • Regularly test the bot in both personal and channel contexts to ensure consistent behavior.

    If the behavior persists despite these checks, it may be beneficial to reach out to Microsoft support for further assistance, as there could be underlying platform constraints affecting the bot's functionality in personal chats.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.