Issue: Custom Agent works on Web but has problems in Microsoft Teams

Erik Duong 0 Reputation points
2026-06-18T07:31:00.1733333+00:00

Hi everyone,

I’m currently deploying an internal MSB Research Agent (custom AI agent) for employees in my organisation.

✅ On web (browser): everything works normally ⚠️ On Microsoft Teams: we are experiencing inconsistent issues


❗ Problems observed in Teams

  • Agent sometimes fails to load
  • Responses are not returned or get stuck
  • Authentication/session seems unstable in some cases

📌 Context

  • The same agent and backend works fine on web
  • Issues only appear when accessed via Teams (app / embedded experience)
  • This is impacting user adoption significantly as most employees use Teams as their primary workspace

User's image


🙏 Looking for advice

Has anyone experienced similar issues when:

  • Integrating custom agents / bots into Teams?
  • Deploying AI copilots inside Teams vs web?

Any guidance on:

  • Debugging approach
  • Known limitations in Teams (auth, iframe, token, etc.)
  • Best practices for stable deployment

would be extremely helpful.


Thanks a lot in advance for your support! 🙌Hi everyone,

I’m currently deploying an internal MSB Research Agent (custom AI agent) for employees in my organisation.

✅ On web (browser): everything works normally
⚠️ On Microsoft Teams: we are experiencing inconsistent issues


❗ Problems observed in Teams

  • Agent sometimes fails to load
  • Responses are not returned or get stuck
  • Authentication/session seems unstable in some cases

📌 Context

  • The same agent and backend works fine on web
  • Issues only appear when accessed via Teams (app / embedded experience)
  • This is impacting user adoption significantly as most employees use Teams as their primary workspace

🙏 Looking for advice

Has anyone experienced similar issues when:

  • Integrating custom agents / bots into Teams?
  • Deploying AI copilots inside Teams vs web?

Any guidance on:

  • Debugging approach
  • Known limitations in Teams (auth, iframe, token, etc.)
  • Best practices for stable deployment

would be extremely helpful.


Thanks a lot in advance for your support! 🙌

Microsoft Copilot | Microsoft 365 Copilot | Development

1 answer

Sort by: Newest
  1. AI answer

    2026-06-18T07:32:04.9533333+00:00

    The behavior described matches several known differences and limitations when running custom agents inside Microsoft 365 Copilot and Microsoft Teams compared to a standalone web experience.

    Key points and checks:

    1. Teams-specific session and state behavior
      • Teams retains conversation state across sessions. This can cause agents to appear “stuck” or to reuse outdated context when users return later.
      • For agents built with Copilot Studio and deployed to Teams, configure an inactivity-based reset:
        1. Create a topic with the The user is inactive for a while trigger.
        2. Set a timeout (for example, 15 minutes).
        3. Add Clear variable values nodes to clear session variables and conversation history.
        4. End the conversation and mark the session as resolved.
      • After reset, send a short message explaining that the conversation was cleared and how to restart. This improves stability and predictability when users come back in Teams.
    2. Manual reset for “stuck” conversations
      • Provide a self-service reset command such as /debug clearstate and document it for users.
      • This command should:
        1. Clear conversation state.
        2. Remove cached connector information.
        3. Reauthenticate connectors.
        4. Load the latest version of the agent.
      • This is particularly useful in Teams where users may keep the same chat open for long periods and encounter intermittent issues.
    3. Testing under real Teams conditions
      • Because Teams preserves state and runs the agent in an embedded environment, test specifically in Teams rather than only in the web channel:
        1. Deploy using Show to only me.
        2. Test long-running scenarios (leave the chat for hours and return).
        3. Publish updates and confirm the agent switches to the new version in Teams.
        4. Validate Adaptive Card rendering on desktop and mobile.
        5. Test actions in varied conversational contexts.
      • Use this checklist to harden the deployment: inactivity trigger configured, reset messaging in place, /debug clearstate documented, version identifier in responses, Force newest version enabled where appropriate, and Greeting topic containing initialization logic.
    4. Known limitations for custom engine agents in Microsoft 365 Copilot / Teams If the MSB Research Agent is implemented as a custom engine agent (using Microsoft 365 Agents Toolkit or Agents SDK) and surfaced in Microsoft 365 Copilot/Teams, be aware of these limitations that can manifest as “inconsistent” behavior compared to web:
      • Conversation context: custom engine agents cannot access Copilot conversation history that occurred before the user @mentions the agent. This can make the agent appear to “forget” context when invoked mid-thread.
      • Chat messages: messages are immutable; updateActivity is not supported. Any design that relies on editing or replacing messages will not work in Teams/Copilot; use follow-up messages instead.
      • Adaptive Cards: cards refreshed via Action.Execute do not persist their updated content when the chat is reopened; the original card is shown. For stable behavior, send new messages instead of relying on card updates.
      • File attachments: users cannot upload files to the agent chat, and the agent cannot return files for download. If the web experience depends on file upload/download, this will not translate directly to Teams.
      • Rich cards and some Adaptive Card elements (for example, certain card types, dynamic refresh, @mentions, typeahead, password control) are not supported and may fail silently or behave unexpectedly.
      • Microsoft 365 app support: custom engine agents are not supported in Outlook, Word, Excel, PowerPoint, or Microsoft Edge; ensure users are accessing the agent from supported entry points (Microsoft 365 Copilot and Teams).
    5. Teams app packaging and diagnostics
      • For issues where the agent fails to load or respond, use the Teams Developer tools:
        1. Open the Teams client, go to the conversation where the agent is used.
        2. Open Settings and more (…) → More tools → Developer tools.
        3. On the Network tab, filter by invoke and inspect failing calls.
        4. Check the standardizedError object (errorCode, errorSubCode, errorDescription) in the response to identify API or configuration issues (for example, 400/401/403/500 errors).
      • If issues persist and cannot be resolved from the network trace and OpenAPI-based testing, contact Microsoft Teams product support with the captured error details.
    6. DOM and iframe considerations (if using embedded pages)
      • When loading Dynamics 365 or other web pages inside Teams, pages that rely on window.top to access DOM elements can fail inside Teams because they are hosted in an iframe. This can lead to errors like “Blocked a frame with origin from accessing a cross-origin frame” and cause pages or scripts not to load correctly.
      • Avoid using window.top in custom JavaScript resources when targeting Teams; instead, design logic that does not depend on accessing the top-level window.
    7. Known platform incidents
      • For some scenarios (for example, publishing Foundry-based agents to Teams), transient platform issues have been resolved by Microsoft via hotfixes. If the same configuration previously worked and suddenly started failing only in Teams, verify current service health and consider retesting after some time or opening a support ticket with detailed error codes.

    Applying these checks and adjustments typically stabilizes agent behavior in Teams and aligns it with the web experience, within the limits of what Microsoft 365 Copilot and Teams currently support for custom agents.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

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.