company logo

Help center

Gleap sayfasına git
Privacy policyDocs
Powered by
Tüm koleksiyonlarBuild custom AI agentsEmbed an agent in your product

Embed an agent in your product

Open an agent's chat, drop in a conversation component, or call it headlessly and use the answer yourself.

Rami Magdi·29 Eylül 2026

An agent doesn't have to live in the Gleap messenger. You can open it from your own interface, embed its conversation as a component, or call it from code and do what you like with the answer.

Open the agent and choose Implementation to get the ready-made snippet for your agent, with its ID already filled in.

warning icon
The implementation code only appears once the agent has the Reply to customer tool. Without it, an agent has no way to say anything outward, so there's nothing to embed.

Open the agent's chat

The simplest option. Call this from a button in your product and the agent's chat opens:

Gleap.startAgent("YOUR_AGENT_ID");

You can also open it with the first question already asked, or with an opening message from the agent, which saves the user staring at an empty box:

Gleap.startAgent("YOUR_AGENT_ID", {
  initialQuestion: "Where is my order?"
});

Embed the conversation as a component

If the agent should sit inside a page rather than open over it, use the conversation element:

<gleap-agent-conversation agentId="YOUR_AGENT_ID" />

This suits a dedicated support page or a panel beside the thing the user is working on.

Call it headlessly

When you want the answer but not Gleap's interface, send a message and use the result in your own UI. The call resolves to an object with the answer text, a run ID, a status, and a conversation ID:

const { response, conversationId } = await Gleap.sendAgentMessage(
  "YOUR_AGENT_ID",
  "Where is my order?"
);

Pass that conversation ID on the next call to continue the same thread rather than starting a fresh one, so the agent still has what was said before:

const next = await Gleap.sendAgentMessage(
  "YOUR_AGENT_ID",
  "And when does it arrive?",
  { conversationId }
);

Which one to use

Use the chat when the agent is something the user talks to. Use the component when it belongs inside a page you already own. Use the headless call when the agent is doing work behind your own interface — filling in a field, drafting something a user then edits — and a chat window would be in the way.

Bu cevap sorunuza yardımcı oldu mu?
😞
😐
😁