Unify Logo Footer.svg
Unify Agentic AI
Logo
Agent Stuck "Thinking" in an Embedded Copilot

Agent Stuck "Thinking" in an Embedded Copilot

Logo

2 mins READ

A maker embeds an agent's Copilot component inside another surface — for example an email add-in — and passes context like a message ID or conversation ID into the agent. The agent works fine in Preview, but once it's live in the real embedded surface, it never responds.

Symptom

Testing the embedded agent in the interface builder's Preview works normally — it responds as expected. But once the same interface is published and used from inside the real embedded surface (for example, an email add-in), the agent never responds: it sits in a permanent "thinking"/loading state and no answer ever comes back.

Cause

The Copilot component's Chat Context maps values (like a message ID or conversation ID) from the surrounding page into the agent's context. When the value being mapped is an object or array — rather than a plain string — the mapping field needs to hold a real expression, not literal text.

If the field was filled in as plain text (for example, referencing a page input or context object directly without wrapping it), the platform parses it as a literal string instead of evaluating it as an expression at runtime. The agent then receives a string where it expected a structured object, fails to process it, and never completes its turn — which is why it looks stuck. This only surfaces in the real embedded environment because Preview and the embedded surface can populate that context differently, so a mismapped value that happens to resolve in Preview can still be broken for the live surface.

Fix

  1. Open the interface that hosts the embedded agent and select the Copilot component in the component hierarchy.

  2. In its properties panel, find the Chat Context section where context values (such as a message ID or conversation ID) are mapped.

  3. For any mapped value that is an object or array (not a plain string), make sure the field holds a dynamic expression — wrapped in {{ }} — rather than literal text. A value like pageInputs.chatId typed as plain text is treated as a string; {{ pageInputs.chatId }} is evaluated as an expression and resolves to the real object.

  4. If the interface embeds more than one Copilot component, repeat the check for each component's own Chat Context field.

  5. Save and Publish the interface so the fix reaches the embedded surface.

To verify, open the embedded surface again (for example, the email add-in) and trigger the agent from it. It should respond normally instead of staying in "thinking" state. If you have access to the browser's developer console, you can also confirm the context value now arrives as an object rather than a string.

Prevention

An agent that works in Preview but hangs only in the real embedded surface is a strong signal to check how context values are mapped into that embedding, not the agent's own configuration — Preview and a live embedded surface can supply page/context data differently, so a mapping bug can pass one and silently break the other. Whenever you map an object or array value into a pill-style field, confirm it's held as a real expression rather than literal text, since a literal string is accepted without error but produces the wrong data type downstream.

Note: A plain-text mapping is accepted without any validation error at save time — the mismatch only shows up as a hang once the agent runs in the real embedded surface.